diff --git a/CHANGELOG.md b/CHANGELOG.md index d285b81a5..aa87cf998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,122 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/HubSpot/hubspot-api-php/compare/12.2.0...HEAD) +## [Unreleased](https://github.com/HubSpot/hubspot-api-php/compare/13.0.0...HEAD) + +## [13.0.0](https://github.com/HubSpot/hubspot-api-php/releases/tag/13.0.0) - 2025-05-12 + +### CRM Tickets + +- Moved method `merge()` from `crm()->tickets()->mergeApi()` to `crm()->tickets()->basicApi()`. +- Removed `crm()->tickets()->mergeApi()` API. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->tickets()->batchApi()->create()`. +- Made `association_category` and `association_type_id` properties required in `HubSpot\Client\Crm\Tickets\Model\AssociationSpec`. +- Made `types` and `to` properties required in `HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject`. +- Made `id` property required in `HubSpot\Client\Crm\Tickets\Model\PublicObjectId`. +- Added property `object_write_trace_id` to `HubSpot\Client\Crm\Tickets\Model\SimplePublicObject`, `HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations` and `HubSpot\Client\Crm\Tickets\Model\SimplePublicUpsertObject`. +- Removed property `object_write_trace_id` from `HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInput` and `HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInputForCreate`. +- Added `email`, `after` and `archived` optrions to `crm()->owners()->getAll()`. + +### Updates + +- Added `createMiddlewareByHttpCodeRanges` and `getRetryFunctionByRanges` methods to `RetryMiddlewareFactory`. +- `504` http code was removed from `RetryMiddlewareFactory::createInternalErrorsMiddleware()`. +- `520-599` http codes range is added to `RetryMiddlewareFactory::createInternalErrorsMiddleware()`. +- + +## [13.0.0beta.1](https://github.com/HubSpot/hubspot-api-php/releases/tag/13.0.0beta.1) - 2025-04-28 + +### CMS + +- Moved methods `archive`, `callClone`, `create`, `getById`, `pushLive`, `resetDraft`, `schedule`, `update` and `updateDraft` from `cms()->blogs()->blogPostsApi()` to `cms()->blogs()->basicApi()`. +- Moved and renamed methods `archiveBatch` => `archive`, `createBatch` => `create`, `readBatch` => `read` and `updateBatch` => `update` from `cms()->blogs()->blogPostsApi()` to `cms()->blogs()->batchApi()`. +- Moved methods `attachToLangGroup`, `createLangVariation`, `detachFromLangGroup`, `setLangPrimary` and `updateLangs` from `cms()->blogs()->blogPostsApi()` to `cms()->blogs()->multiLanguageApi()`. +- Removed `cms()->perfomance()` API client. + +### CRM + +- Added `crm()->associations()->v4()->schema()->definitionConfigurationsApi()` API. +- Renamed method `crm()->associations()->v4()->schema()->definitionsApi()->archive()` to `crm()->associations()->v4()->schema()->definitionsApi()->remove()`. +- Added `crm()->extensions()->calling()->channelConnectionSettingsApi()` API. +- Added properties `uses_remote` and `uses_calling_window` to `HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest`, `HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest` and `HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse`. +- Added options `include_error_message` and `include_row_data` to `crm()->imports()->publicImportsApi()->getErrors()`. +- Added property `contains_encrypted_properties` to `HubSpot\Client\Crm\Imports\Model\ImportRowCore`. +- Added properties `invalid_property_value`, `error_message` and `invalid_value_to_display` to `HubSpot\Client\Crm\Imports\Model\PublicImportError`. +- Added property `mapped_object_type_ids` to `HubSpot\Client\Crm\Imports\Model\PublicImportResponse`. + +### CRM objects + +- Moved method `merge()` from `crm()->companies()->mergeApi()` to `crm()->companies()->basicApi()`. +- Removed `crm()->companies()->mergeApi()` API. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->companies()->batchApi()->create()`. +- Made `association_category` and `association_type_id` properties required in `HubSpot\Client\Crm\Companies\Model\AssociationSpec`, `HubSpot\Client\Crm\Contacts\Model\AssociationSpec`, `HubSpot\Client\Crm\Deals\Model\AssociationSpec`. +- Made `types` and `to` properties required in `HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject`, `HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject`, `HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject`. +- Made `id` property required in `HubSpot\Client\Crm\Companies\Model\PublicObjectId`, `HubSpot\Client\Crm\Contacts\Model\PublicObjectId`, `HubSpot\Client\Crm\Deals\Model\PublicObjectId`. +- Added property `object_write_trace_id` to `HubSpot\Client\Crm\Companies\Model\SimplePublicObject`, `HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Companies\Model\SimplePublicUpsertObject`, `HubSpot\Client\Crm\Contacts\Model\SimplePublicObject`, `HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Contacts\Model\SimplePublicUpsertObject`,`HubSpot\Client\Crm\Deals\Model\SimplePublicObject`, `HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Deals\Model\SimplePublicUpsertObject`, `HubSpot\Client\Crm\LineItems\Model\SimplePublicObject`, `HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\LineItems\Model\SimplePublicUpsertObject`, `HubSpot\Client\Crm\Quotes\Model\SimplePublicObject`, `HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Quotes\Model\SimplePublicUpsertObject`, `HubSpot\Client\Crm\Objects\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Model\SimplePublicUpsertObject`, `HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicUpsertObject`, `HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicUpsertObject`, `HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicUpsertObject`, +`HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations`, +`HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicUpsertObject`, +`HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations`, +`HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicUpsertObject`, +`HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicUpsertObject`, +`HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicUpsertObject`, +`HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicUpsertObject`, +`HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject`, `HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations`, `HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicUpsertObject`, +`HubSpot\Client\Crm\Products\Model\SimplePublicObject`, `HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations` and `HubSpot\Client\Crm\Products\Model\SimplePublicUpsertObject`. +- Removed property `object_write_trace_id` from `HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput`, `HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate`, `HubSpot\Client\Crm\Products\Model\SimplePublicObjectInput` and `HubSpot\Client\Crm\Products\Model\SimplePublicObjectInputForCreate`. +- Moved method `merge()` from `crm()->contacts()->mergeApi()` to `crm()->contacts()->basicApi()`. +- Removed `crm()->contacts()->mergeApi()` API. +- Moved method `purge()` from `crm()->contacts()->GDPRApi()` to `crm()->contacts()->basicApi()`. +- Removed `crm()->contacts()->GDPRApi()` API. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->contacts()->batchApi()->create()`. +- Moved method `merge()` from `crm()->deals()->mergeApi()` to `crm()->deals()->basicApi()`. +- Removed `crm()->deals()->mergeApi()` API. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->deals()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->lineItems()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->quotes()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->calls()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->emails()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->leads()->batchApi()->create()`. +- Added methods `archive()`, `create()` and `update()` to `crm()->objects()->goals()->basicApi()`. +- Added methods `archive()`, `create()`, `upsert()` and `update()` to `crm()->objects()->goals()->batchApi()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->meetings()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->notes()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->postalMail()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->tasks()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->objects()->taxes()->batchApi()->create()`. +- Changed option type `batch_input_simple_public_object_input_for_create: HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectInputForCreate` to `batch_input_simple_public_object_batch_input_for_create: HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectBatchInputForCreate` in `crm()->products()->batchApi()->create()`. + +### Events + +- Renamed `events()->send()->customEventDataApi()` to `events()->send()->basicApi()`. +- Added `events()->send()->batchApi()` API. + +### Marketing Events + +- Renamed `marketing()->events()->attendanceSubscriberStateChangesApi()` to `marketing()->events()->addEventAttendeesApi()`. +- Added new methods `recordByContactId()` and `recordByEmail()` to `marketing()->events()->addEventAttendeesApi()`. +- Added `marketing()->events()->batchApi()` API. +- Moved and renamed methods `batchArchive` => `archive` and `batchUpsert` => `create` from `marketing()->events()->basicApi()` to `marketing()->events()->batchApi()`. +- Added new methods `archiveByObjectId()`, `getAll()`, `getByObjectId()` and `updateByObjectId()` to `marketing()->events()->basicApi()`. +- Moved methods `cancel` and `complete` from `marketing()->events()->basicApi()` to `marketing()->events()->changePropertyApi()`. +- Added `marketing()->events()->identifiersApi()` API. +- Moved method `doSearch()` from `marketing()->events()->basicApi()` to `marketing()->events()->identifiersApi()`. +- Renamed `marketing()->events()->participantStateApi()` to `marketing()->events()->retrieveParticipantStateApi()`. +- Changed the response object type from `\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error` to `\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging|\HubSpot\Client\Marketing\Events\Model\Error` for `marketing()->events()->identifiersApi()->doSearch()`. +- Added new property `object_id` to `HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse`, `HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse` and `HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse`. + +### Files + +- Changed incomining parameters list in `files()->filesApi()->doSearch()`. +- Renamed method `archiveGDPR()` to `delete()` in `files.filesApi`. +- Renamed method `updateProperties()` to `updatePropertiesRecursively()` in `files.foldersApi`. +- Added new method `updateProperties()` to `files.foldersApi`. +- Changed incomining parameters list in `files()->foldersApi()->doSearch()`. +- Added properties `source_group` and `file_md5` to `HubSpot\Client\Files\Model\File`. +- Added property `clear_expires` to `HubSpot\Client\Files\Model\FileUpdateInput`. +- Changed property type from `expires_at:int` to `expires_at:\DateTime` in `HubSpot\Client\Files\Model\FileUpdateInput`. +- Added property `expires_at` to `HubSpot\Client\Files\Model\ImportFromUrlInput`. +- Removed property `id` from `HubSpot\Client\Files\Model\FolderUpdateInput`. ## [12.2.0](https://github.com/HubSpot/hubspot-api-php/releases/tag/12.2.0) - 2025-04-28 @@ -90,7 +205,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Renamed method `doCancel` to `cancel` in `marketing()->events()->basicApi()`. - Renamed method `getById` to `getDetails` in `marketing()->events()->basicApi()`. - Renamed method `replace` to `upsert` in `marketing()->events()->basicApi()`. -ListAssociationsApi +- Added `marketing()->events()->listAssociationsApi()` API. - Renamed method `create` to `update` in `marketing()->events()->settingsApi()`. - Renamed method `doEmailUpsertById` to `upsertByContactEmail` in `marketing()->events()->subscriberStateChangesApi()`. - Renamed method `doUpsertById` to `upsertByContactId` in `marketing()->events()->subscriberStateChangesApi()`. @@ -861,7 +976,7 @@ ListAssociationsApi 25. getSubscriptions => getAll (webhooks()->subscriptionsApi()) 26. updateSubscription => update (webhooks()->subscriptionsApi()) -[Unreleased]: https://github.com/HubSpot/hubspot-api-php/compare/12.2.0...HEAD +[Unreleased]: https://github.com/HubSpot/hubspot-api-php/compare/13.0.0...HEAD [1.0.0-beta]: https://github.com/HubSpot/hubspot-api-php/releases/tag/v1.0.0-beta [1.1.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/1.1.0 [1.2.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/1.2.0 @@ -921,3 +1036,5 @@ ListAssociationsApi [12.0.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/12.0.0 [12.1.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/12.1.0 [12.2.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/12.2.0 +[13.0.0beta.1]: https://github.com/HubSpot/hubspot-api-php/releases/tag/13.0.0beta.1 +[13.0.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/13.0.0 diff --git a/README.md b/README.md index a8eb00032..7f0350e3a 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,11 @@ $response = $hubspot->apiRequest([ ]); ``` +## Reserved words + +The SDK has reserved words(e.g. `clone`). [Full list of reserved words.](https://openapi-generator.tech/docs/generators/php#reserved-words) +When you face with a reserved word you have to add `_` before the word(e.g. `_clone`). + ## Contributing ### Run spec tests diff --git a/codegen/Automation/Actions/Api/CallbacksApi.php b/codegen/Automation/Actions/Api/CallbacksApi.php index 23440ced2..37bc3771f 100644 --- a/codegen/Automation/Actions/Api/CallbacksApi.php +++ b/codegen/Automation/Actions/Api/CallbacksApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class CallbacksApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -128,9 +128,9 @@ public function getConfig() /** * Operation complete * - * Completes a single callback + * Completes a callback * - * @param string $callback_id callback_id (required) + * @param string $callback_id The ID of the action execution. (required) * @param \HubSpot\Client\Automation\Actions\Model\CallbackCompletionRequest $callback_completion_request callback_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * @@ -146,9 +146,9 @@ public function complete($callback_id, $callback_completion_request, string $con /** * Operation completeWithHttpInfo * - * Completes a single callback + * Completes a callback * - * @param string $callback_id (required) + * @param string $callback_id The ID of the action execution. (required) * @param \HubSpot\Client\Automation\Actions\Model\CallbackCompletionRequest $callback_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * @@ -182,18 +182,6 @@ public function completeWithHttpInfo($callback_id, $callback_completion_request, $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -215,9 +203,9 @@ public function completeWithHttpInfo($callback_id, $callback_completion_request, /** * Operation completeAsync * - * Completes a single callback + * Completes a callback * - * @param string $callback_id (required) + * @param string $callback_id The ID of the action execution. (required) * @param \HubSpot\Client\Automation\Actions\Model\CallbackCompletionRequest $callback_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * @@ -237,9 +225,9 @@ function ($response) { /** * Operation completeAsyncWithHttpInfo * - * Completes a single callback + * Completes a callback * - * @param string $callback_id (required) + * @param string $callback_id The ID of the action execution. (required) * @param \HubSpot\Client\Automation\Actions\Model\CallbackCompletionRequest $callback_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * @@ -277,7 +265,7 @@ function ($exception) { /** * Create request for operation 'complete' * - * @param string $callback_id (required) + * @param string $callback_id The ID of the action execution. (required) * @param \HubSpot\Client\Automation\Actions\Model\CallbackCompletionRequest $callback_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * @@ -388,7 +376,7 @@ public function completeRequest($callback_id, $callback_completion_request, stri /** * Operation completeBatch * - * Completes a batch of callbacks + * Complete a batch of callbacks * * @param \HubSpot\Client\Automation\Actions\Model\BatchInputCallbackCompletionBatchRequest $batch_input_callback_completion_batch_request batch_input_callback_completion_batch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeBatch'] to see the possible values for this operation @@ -405,7 +393,7 @@ public function completeBatch($batch_input_callback_completion_batch_request, st /** * Operation completeBatchWithHttpInfo * - * Completes a batch of callbacks + * Complete a batch of callbacks * * @param \HubSpot\Client\Automation\Actions\Model\BatchInputCallbackCompletionBatchRequest $batch_input_callback_completion_batch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeBatch'] to see the possible values for this operation @@ -440,18 +428,6 @@ public function completeBatchWithHttpInfo($batch_input_callback_completion_batch $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -473,7 +449,7 @@ public function completeBatchWithHttpInfo($batch_input_callback_completion_batch /** * Operation completeBatchAsync * - * Completes a batch of callbacks + * Complete a batch of callbacks * * @param \HubSpot\Client\Automation\Actions\Model\BatchInputCallbackCompletionBatchRequest $batch_input_callback_completion_batch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeBatch'] to see the possible values for this operation @@ -494,7 +470,7 @@ function ($response) { /** * Operation completeBatchAsyncWithHttpInfo * - * Completes a batch of callbacks + * Complete a batch of callbacks * * @param \HubSpot\Client\Automation\Actions\Model\BatchInputCallbackCompletionBatchRequest $batch_input_callback_completion_batch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['completeBatch'] to see the possible values for this operation diff --git a/codegen/Automation/Actions/Api/DefinitionsApi.php b/codegen/Automation/Actions/Api/DefinitionsApi.php index d21419e31..b831d38d7 100644 --- a/codegen/Automation/Actions/Api/DefinitionsApi.php +++ b/codegen/Automation/Actions/Api/DefinitionsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class DefinitionsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,10 +137,10 @@ public function getConfig() /** * Operation archive * - * Archive an extension definition + * Delete an action definition * - * @param string $definition_id definition_id (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -155,10 +155,10 @@ public function archive($definition_id, $app_id, string $contentType = self::con /** * Operation archiveWithHttpInfo * - * Archive an extension definition + * Delete an action definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -191,18 +191,6 @@ public function archiveWithHttpInfo($definition_id, $app_id, string $contentType $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -224,10 +212,10 @@ public function archiveWithHttpInfo($definition_id, $app_id, string $contentType /** * Operation archiveAsync * - * Archive an extension definition + * Delete an action definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -246,10 +234,10 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive an extension definition + * Delete an action definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -286,8 +274,8 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -399,9 +387,9 @@ public function archiveRequest($definition_id, $app_id, string $contentType = se /** * Operation create * - * Create a new extension definition + * Create a new custom action definition * - * @param int $app_id app_id (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionEgg $public_action_definition_egg public_action_definition_egg (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -418,9 +406,9 @@ public function create($app_id, $public_action_definition_egg, string $contentTy /** * Operation createWithHttpInfo * - * Create a new extension definition + * Create a new custom action definition * - * @param int $app_id (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionEgg $public_action_definition_egg (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -454,18 +442,6 @@ public function createWithHttpInfo($app_id, $public_action_definition_egg, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -524,6 +500,19 @@ public function createWithHttpInfo($app_id, $public_action_definition_egg, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionDefinition'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -578,9 +567,9 @@ public function createWithHttpInfo($app_id, $public_action_definition_egg, strin /** * Operation createAsync * - * Create a new extension definition + * Create a new custom action definition * - * @param int $app_id (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionEgg $public_action_definition_egg (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -600,9 +589,9 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Create a new extension definition + * Create a new custom action definition * - * @param int $app_id (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionEgg $public_action_definition_egg (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -653,7 +642,7 @@ function ($exception) { /** * Create request for operation 'create' * - * @param int $app_id (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionEgg $public_action_definition_egg (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -765,11 +754,11 @@ public function createRequest($app_id, $public_action_definition_egg, string $co /** * Operation getById * - * Get extension definition by Id + * Retrieve a custom action definition * - * @param string $definition_id definition_id (required) - * @param int $app_id app_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $definition_id The ID of the custom action. (required) + * @param int $app_id The ID of the app. (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -785,11 +774,11 @@ public function getById($definition_id, $app_id, $archived = false, string $cont /** * Operation getByIdWithHttpInfo * - * Get extension definition by Id + * Retrieve a custom action definition * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $definition_id The ID of the custom action. (required) + * @param int $app_id The ID of the app. (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -822,18 +811,6 @@ public function getByIdWithHttpInfo($definition_id, $app_id, $archived = false, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -892,6 +869,19 @@ public function getByIdWithHttpInfo($definition_id, $app_id, $archived = false, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionDefinition'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -946,11 +936,11 @@ public function getByIdWithHttpInfo($definition_id, $app_id, $archived = false, /** * Operation getByIdAsync * - * Get extension definition by Id + * Retrieve a custom action definition * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $definition_id The ID of the custom action. (required) + * @param int $app_id The ID of the app. (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -969,11 +959,11 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Get extension definition by Id + * Retrieve a custom action definition * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $definition_id The ID of the custom action. (required) + * @param int $app_id The ID of the app. (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1023,9 +1013,9 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $definition_id The ID of the custom action. (required) + * @param int $app_id The ID of the app. (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1147,12 +1137,12 @@ public function getByIdRequest($definition_id, $app_id, $archived = false, strin /** * Operation getPage * - * Get paged extension definitions + * Retrieve custom action definitions * - * @param int $app_id app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -1168,12 +1158,12 @@ public function getPage($app_id, $limit = null, $after = null, $archived = false /** * Operation getPageWithHttpInfo * - * Get paged extension definitions + * Retrieve custom action definitions * - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -1206,18 +1196,6 @@ public function getPageWithHttpInfo($app_id, $limit = null, $after = null, $arch $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1276,6 +1254,19 @@ public function getPageWithHttpInfo($app_id, $limit = null, $after = null, $arch ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\CollectionResponsePublicActionDefinitionForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1330,12 +1321,12 @@ public function getPageWithHttpInfo($app_id, $limit = null, $after = null, $arch /** * Operation getPageAsync * - * Get paged extension definitions + * Retrieve custom action definitions * - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1354,12 +1345,12 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * Get paged extension definitions + * Retrieve custom action definitions * - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1409,10 +1400,10 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1539,10 +1530,10 @@ public function getPageRequest($app_id, $limit = null, $after = null, $archived /** * Operation update * - * Patch an existing extension definition + * Update an existing action definition * - * @param string $definition_id definition_id (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionPatch $public_action_definition_patch public_action_definition_patch (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1559,10 +1550,10 @@ public function update($definition_id, $app_id, $public_action_definition_patch, /** * Operation updateWithHttpInfo * - * Patch an existing extension definition + * Update an existing action definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionPatch $public_action_definition_patch (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1596,18 +1587,6 @@ public function updateWithHttpInfo($definition_id, $app_id, $public_action_defin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1666,6 +1645,19 @@ public function updateWithHttpInfo($definition_id, $app_id, $public_action_defin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionDefinition'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1720,10 +1712,10 @@ public function updateWithHttpInfo($definition_id, $app_id, $public_action_defin /** * Operation updateAsync * - * Patch an existing extension definition + * Update an existing action definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionPatch $public_action_definition_patch (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1743,10 +1735,10 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Patch an existing extension definition + * Update an existing action definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionPatch $public_action_definition_patch (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1797,8 +1789,8 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the custom action definition. (required) + * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Automation\Actions\Model\PublicActionDefinitionPatch $public_action_definition_patch (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * diff --git a/codegen/Automation/Actions/Api/FunctionsApi.php b/codegen/Automation/Actions/Api/FunctionsApi.php index 65fbed433..bb60c0742 100644 --- a/codegen/Automation/Actions/Api/FunctionsApi.php +++ b/codegen/Automation/Actions/Api/FunctionsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -101,13 +101,13 @@ class FunctionsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -201,18 +201,6 @@ public function archiveWithHttpInfo($definition_id, $function_type, $function_id $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -447,9 +435,9 @@ public function archiveRequest($definition_id, $function_type, $function_id, $ap * * Delete a function for a definition * - * @param string $definition_id definition_id (required) - * @param string $function_type function_type (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByFunctionType'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -466,9 +454,9 @@ public function archiveByFunctionType($definition_id, $function_type, $app_id, s * * Delete a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByFunctionType'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -501,18 +489,6 @@ public function archiveByFunctionTypeWithHttpInfo($definition_id, $function_type $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -536,9 +512,9 @@ public function archiveByFunctionTypeWithHttpInfo($definition_id, $function_type * * Delete a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByFunctionType'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -559,9 +535,9 @@ function ($response) { * * Delete a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByFunctionType'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -598,9 +574,9 @@ function ($exception) { /** * Create request for operation 'archiveByFunctionType' * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByFunctionType'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -727,12 +703,12 @@ public function archiveByFunctionTypeRequest($definition_id, $function_type, $ap /** * Operation createOrReplace * - * Insert a function for a definition + * Update a function for a definition * - * @param string $definition_id definition_id (required) - * @param string $function_type function_type (required) - * @param string $function_id function_id (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $body body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplace'] to see the possible values for this operation * @@ -749,12 +725,12 @@ public function createOrReplace($definition_id, $function_type, $function_id, $a /** * Operation createOrReplaceWithHttpInfo * - * Insert a function for a definition + * Update a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplace'] to see the possible values for this operation * @@ -788,18 +764,6 @@ public function createOrReplaceWithHttpInfo($definition_id, $function_type, $fun $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -858,6 +822,19 @@ public function createOrReplaceWithHttpInfo($definition_id, $function_type, $fun ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionFunctionIdentifier'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -912,12 +889,12 @@ public function createOrReplaceWithHttpInfo($definition_id, $function_type, $fun /** * Operation createOrReplaceAsync * - * Insert a function for a definition + * Update a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplace'] to see the possible values for this operation * @@ -937,12 +914,12 @@ function ($response) { /** * Operation createOrReplaceAsyncWithHttpInfo * - * Insert a function for a definition + * Update a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplace'] to see the possible values for this operation * @@ -993,10 +970,10 @@ function ($exception) { /** * Create request for operation 'createOrReplace' * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplace'] to see the possible values for this operation * @@ -1155,9 +1132,9 @@ public function createOrReplaceRequest($definition_id, $function_type, $function * * Insert a function for a definition * - * @param string $definition_id definition_id (required) - * @param string $function_type function_type (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $body body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplaceByFunctionType'] to see the possible values for this operation * @@ -1176,9 +1153,9 @@ public function createOrReplaceByFunctionType($definition_id, $function_type, $a * * Insert a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplaceByFunctionType'] to see the possible values for this operation * @@ -1212,18 +1189,6 @@ public function createOrReplaceByFunctionTypeWithHttpInfo($definition_id, $funct $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1282,6 +1247,19 @@ public function createOrReplaceByFunctionTypeWithHttpInfo($definition_id, $funct ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionFunctionIdentifier'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1338,9 +1316,9 @@ public function createOrReplaceByFunctionTypeWithHttpInfo($definition_id, $funct * * Insert a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplaceByFunctionType'] to see the possible values for this operation * @@ -1362,9 +1340,9 @@ function ($response) { * * Insert a function for a definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplaceByFunctionType'] to see the possible values for this operation * @@ -1415,9 +1393,9 @@ function ($exception) { /** * Create request for operation 'createOrReplaceByFunctionType' * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrReplaceByFunctionType'] to see the possible values for this operation * @@ -1559,11 +1537,11 @@ public function createOrReplaceByFunctionTypeRequest($definition_id, $function_t /** * Operation getByFunctionType * - * Get all functions by a type for a given definition + * Retrieve functions by a type for a given definition * - * @param string $definition_id definition_id (required) - * @param string $function_type function_type (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByFunctionType'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -1579,11 +1557,11 @@ public function getByFunctionType($definition_id, $function_type, $app_id, strin /** * Operation getByFunctionTypeWithHttpInfo * - * Get all functions by a type for a given definition + * Retrieve functions by a type for a given definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByFunctionType'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -1616,18 +1594,6 @@ public function getByFunctionTypeWithHttpInfo($definition_id, $function_type, $a $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1686,6 +1652,19 @@ public function getByFunctionTypeWithHttpInfo($definition_id, $function_type, $a ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionFunction'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1740,11 +1719,11 @@ public function getByFunctionTypeWithHttpInfo($definition_id, $function_type, $a /** * Operation getByFunctionTypeAsync * - * Get all functions by a type for a given definition + * Retrieve functions by a type for a given definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByFunctionType'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1763,11 +1742,11 @@ function ($response) { /** * Operation getByFunctionTypeAsyncWithHttpInfo * - * Get all functions by a type for a given definition + * Retrieve functions by a type for a given definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByFunctionType'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1817,9 +1796,9 @@ function ($exception) { /** * Create request for operation 'getByFunctionType' * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByFunctionType'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1946,12 +1925,12 @@ public function getByFunctionTypeRequest($definition_id, $function_type, $app_id /** * Operation getById * - * Get a function for a given definition + * Retrieve a function from a given definition * - * @param string $definition_id definition_id (required) - * @param string $function_type function_type (required) - * @param string $function_id function_id (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -1967,12 +1946,12 @@ public function getById($definition_id, $function_type, $function_id, $app_id, s /** * Operation getByIdWithHttpInfo * - * Get a function for a given definition + * Retrieve a function from a given definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -2005,18 +1984,6 @@ public function getByIdWithHttpInfo($definition_id, $function_type, $function_id $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2075,6 +2042,19 @@ public function getByIdWithHttpInfo($definition_id, $function_type, $function_id ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionFunction'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2129,12 +2109,12 @@ public function getByIdWithHttpInfo($definition_id, $function_type, $function_id /** * Operation getByIdAsync * - * Get a function for a given definition + * Retrieve a function from a given definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2153,12 +2133,12 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Get a function for a given definition + * Retrieve a function from a given definition * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2208,10 +2188,10 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $definition_id (required) - * @param string $function_type (required) - * @param string $function_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $function_type The type of function. Can be `PRE_ACTION_EXECUTION`, `PRE_FETCH_OPTIONS`, `POST_FETCH_OPTIONS`, `POST_ACTION_EXECUTION`. (required) + * @param string $function_id The ID of the function. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2353,10 +2333,10 @@ public function getByIdRequest($definition_id, $function_type, $function_id, $ap /** * Operation getPage * - * Get all functions for a given definition + * Retrieve functions for a given definition * - * @param string $definition_id definition_id (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -2372,10 +2352,10 @@ public function getPage($definition_id, $app_id, string $contentType = self::con /** * Operation getPageWithHttpInfo * - * Get all functions for a given definition + * Retrieve functions for a given definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -2408,18 +2388,6 @@ public function getPageWithHttpInfo($definition_id, $app_id, string $contentType $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2478,6 +2446,19 @@ public function getPageWithHttpInfo($definition_id, $app_id, string $contentType ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\CollectionResponsePublicActionFunctionIdentifierNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2532,10 +2513,10 @@ public function getPageWithHttpInfo($definition_id, $app_id, string $contentType /** * Operation getPageAsync * - * Get all functions for a given definition + * Retrieve functions for a given definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2554,10 +2535,10 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * Get all functions for a given definition + * Retrieve functions for a given definition * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2607,8 +2588,8 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $definition_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Automation/Actions/Api/RevisionsApi.php b/codegen/Automation/Actions/Api/RevisionsApi.php index e816473b7..d924b0b0c 100644 --- a/codegen/Automation/Actions/Api/RevisionsApi.php +++ b/codegen/Automation/Actions/Api/RevisionsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class RevisionsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -128,11 +128,11 @@ public function getConfig() /** * Operation getById * - * Gets a revision for a given definition by revision id + * Retrieve a specific revision of a definition * - * @param string $definition_id definition_id (required) - * @param string $revision_id revision_id (required) - * @param int $app_id app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $revision_id The ID of the revision. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -148,11 +148,11 @@ public function getById($definition_id, $revision_id, $app_id, string $contentTy /** * Operation getByIdWithHttpInfo * - * Gets a revision for a given definition by revision id + * Retrieve a specific revision of a definition * - * @param string $definition_id (required) - * @param string $revision_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $revision_id The ID of the revision. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -185,18 +185,6 @@ public function getByIdWithHttpInfo($definition_id, $revision_id, $app_id, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -255,6 +243,19 @@ public function getByIdWithHttpInfo($definition_id, $revision_id, $app_id, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\PublicActionRevision'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -309,11 +310,11 @@ public function getByIdWithHttpInfo($definition_id, $revision_id, $app_id, strin /** * Operation getByIdAsync * - * Gets a revision for a given definition by revision id + * Retrieve a specific revision of a definition * - * @param string $definition_id (required) - * @param string $revision_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $revision_id The ID of the revision. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -332,11 +333,11 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Gets a revision for a given definition by revision id + * Retrieve a specific revision of a definition * - * @param string $definition_id (required) - * @param string $revision_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $revision_id The ID of the revision. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -386,9 +387,9 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $definition_id (required) - * @param string $revision_id (required) - * @param int $app_id (required) + * @param string $definition_id The ID of the definition. (required) + * @param string $revision_id The ID of the revision. (required) + * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -515,12 +516,12 @@ public function getByIdRequest($definition_id, $revision_id, $app_id, string $co /** * Operation getPage * - * Get all revisions for a given definition + * Retrieve revisions for a given definition * - * @param string $definition_id definition_id (required) - * @param int $app_id app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -536,12 +537,12 @@ public function getPage($definition_id, $app_id, $limit = null, $after = null, s /** * Operation getPageWithHttpInfo * - * Get all revisions for a given definition + * Retrieve revisions for a given definition * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Automation\Actions\ApiException on non-2xx response or if the response body is not in the expected format @@ -574,18 +575,6 @@ public function getPageWithHttpInfo($definition_id, $app_id, $limit = null, $aft $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -644,6 +633,19 @@ public function getPageWithHttpInfo($definition_id, $app_id, $limit = null, $aft ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Automation\Actions\Model\CollectionResponsePublicActionRevisionForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -698,12 +700,12 @@ public function getPageWithHttpInfo($definition_id, $app_id, $limit = null, $aft /** * Operation getPageAsync * - * Get all revisions for a given definition + * Retrieve revisions for a given definition * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -722,12 +724,12 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * Get all revisions for a given definition + * Retrieve revisions for a given definition * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -777,10 +779,10 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $definition_id (required) - * @param int $app_id (required) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string $definition_id The ID of the definition. (required) + * @param int $app_id The ID of the app. (required) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Automation/Actions/ApiException.php b/codegen/Automation/Actions/ApiException.php index 694ff71c7..ba5587292 100644 --- a/codegen/Automation/Actions/ApiException.php +++ b/codegen/Automation/Actions/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Automation/Actions/Configuration.php b/codegen/Automation/Actions/Configuration.php index 212101fd3..66ed47045 100644 --- a/codegen/Automation/Actions/Configuration.php +++ b/codegen/Automation/Actions/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Automation/Actions/HeaderSelector.php b/codegen/Automation/Actions/HeaderSelector.php index f10e08dcd..18dc9de06 100644 --- a/codegen/Automation/Actions/HeaderSelector.php +++ b/codegen/Automation/Actions/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Automation/Actions/Model/BatchInputCallbackCompletionBatchRequest.php b/codegen/Automation/Actions/Model/BatchInputCallbackCompletionBatchRequest.php index 9da6c34e7..f797bb74b 100644 --- a/codegen/Automation/Actions/Model/BatchInputCallbackCompletionBatchRequest.php +++ b/codegen/Automation/Actions/Model/BatchInputCallbackCompletionBatchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Automation/Actions/Model/CallbackCompletionBatchRequest.php b/codegen/Automation/Actions/Model/CallbackCompletionBatchRequest.php index 0dcdbdad1..a56bbf125 100644 --- a/codegen/Automation/Actions/Model/CallbackCompletionBatchRequest.php +++ b/codegen/Automation/Actions/Model/CallbackCompletionBatchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('output_fields', $data ?? [], null); $this->setIfExists('callback_id', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/CallbackCompletionRequest.php b/codegen/Automation/Actions/Model/CallbackCompletionRequest.php index 7a4f5bef0..aaeb5b9ee 100644 --- a/codegen/Automation/Actions/Model/CallbackCompletionRequest.php +++ b/codegen/Automation/Actions/Model/CallbackCompletionRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('output_fields', $data ?? [], null); } diff --git a/codegen/Automation/Actions/Model/CollectionResponsePublicActionDefinitionForwardPaging.php b/codegen/Automation/Actions/Model/CollectionResponsePublicActionDefinitionForwardPaging.php index bf583fb80..0521dc193 100644 --- a/codegen/Automation/Actions/Model/CollectionResponsePublicActionDefinitionForwardPaging.php +++ b/codegen/Automation/Actions/Model/CollectionResponsePublicActionDefinitionForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/CollectionResponsePublicActionFunctionIdentifierNoPaging.php b/codegen/Automation/Actions/Model/CollectionResponsePublicActionFunctionIdentifierNoPaging.php index 0772fb1b5..4a316536d 100644 --- a/codegen/Automation/Actions/Model/CollectionResponsePublicActionFunctionIdentifierNoPaging.php +++ b/codegen/Automation/Actions/Model/CollectionResponsePublicActionFunctionIdentifierNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Automation/Actions/Model/CollectionResponsePublicActionRevisionForwardPaging.php b/codegen/Automation/Actions/Model/CollectionResponsePublicActionRevisionForwardPaging.php index 1a68f0281..2f31c11f8 100644 --- a/codegen/Automation/Actions/Model/CollectionResponsePublicActionRevisionForwardPaging.php +++ b/codegen/Automation/Actions/Model/CollectionResponsePublicActionRevisionForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/Error.php b/codegen/Automation/Actions/Model/Error.php index 6a7099c28..20274b0a9 100644 --- a/codegen/Automation/Actions/Model/Error.php +++ b/codegen/Automation/Actions/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/ErrorDetail.php b/codegen/Automation/Actions/Model/ErrorDetail.php index bd2ff5aba..a6d5e346c 100644 --- a/codegen/Automation/Actions/Model/ErrorDetail.php +++ b/codegen/Automation/Actions/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/FieldTypeDefinition.php b/codegen/Automation/Actions/Model/FieldTypeDefinition.php index b341acb7a..e4fd99699 100644 --- a/codegen/Automation/Actions/Model/FieldTypeDefinition.php +++ b/codegen/Automation/Actions/Model/FieldTypeDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -692,10 +692,10 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('help_text', $data ?? [], null); $this->setIfExists('referenced_object_type', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/ForwardPaging.php b/codegen/Automation/Actions/Model/ForwardPaging.php index c63db1856..5f5c3defd 100644 --- a/codegen/Automation/Actions/Model/ForwardPaging.php +++ b/codegen/Automation/Actions/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Automation/Actions/Model/InputFieldDefinition.php b/codegen/Automation/Actions/Model/InputFieldDefinition.php index f7706328b..650c28533 100644 --- a/codegen/Automation/Actions/Model/InputFieldDefinition.php +++ b/codegen/Automation/Actions/Model/InputFieldDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -278,10 +278,10 @@ public function getSupportedValueTypesAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('is_required', $data ?? [], null); $this->setIfExists('automation_field_type', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/ModelInterface.php b/codegen/Automation/Actions/Model/ModelInterface.php index 90a218266..c49be9e69 100644 --- a/codegen/Automation/Actions/Model/ModelInterface.php +++ b/codegen/Automation/Actions/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Automation/Actions/Model/NextPage.php b/codegen/Automation/Actions/Model/NextPage.php index b77f5a920..5739b86e7 100644 --- a/codegen/Automation/Actions/Model/NextPage.php +++ b/codegen/Automation/Actions/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/Option.php b/codegen/Automation/Actions/Model/Option.php index 4431c2987..90eba07ea 100644 --- a/codegen/Automation/Actions/Model/Option.php +++ b/codegen/Automation/Actions/Model/Option.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/OutputFieldDefinition.php b/codegen/Automation/Actions/Model/OutputFieldDefinition.php index a8a47fd25..e527d3031 100644 --- a/codegen/Automation/Actions/Model/OutputFieldDefinition.php +++ b/codegen/Automation/Actions/Model/OutputFieldDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type_definition', $data ?? [], null); } diff --git a/codegen/Automation/Actions/Model/PublicActionDefinition.php b/codegen/Automation/Actions/Model/PublicActionDefinition.php index f6071e44d..8d5f5d062 100644 --- a/codegen/Automation/Actions/Model/PublicActionDefinition.php +++ b/codegen/Automation/Actions/Model/PublicActionDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -311,10 +311,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('functions', $data ?? [], null); $this->setIfExists('action_url', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicActionDefinitionEgg.php b/codegen/Automation/Actions/Model/PublicActionDefinitionEgg.php index cd2bc4557..3c4a95826 100644 --- a/codegen/Automation/Actions/Model/PublicActionDefinitionEgg.php +++ b/codegen/Automation/Actions/Model/PublicActionDefinitionEgg.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -299,10 +299,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('input_fields', $data ?? [], null); $this->setIfExists('output_fields', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicActionDefinitionInputFieldDependenciesInner.php b/codegen/Automation/Actions/Model/PublicActionDefinitionInputFieldDependenciesInner.php index bd707c374..1593d2a6e 100644 --- a/codegen/Automation/Actions/Model/PublicActionDefinitionInputFieldDependenciesInner.php +++ b/codegen/Automation/Actions/Model/PublicActionDefinitionInputFieldDependenciesInner.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ class PublicActionDefinitionInputFieldDependenciesInner implements ModelInterfac */ protected static $openAPITypes = [ 'dependency_type' => 'string', - 'dependent_field_names' => 'string[]', 'controlling_field_name' => 'string', + 'dependent_field_names' => 'string[]', 'controlling_field_value' => 'string' ]; @@ -72,8 +72,8 @@ class PublicActionDefinitionInputFieldDependenciesInner implements ModelInterfac */ protected static $openAPIFormats = [ 'dependency_type' => null, - 'dependent_field_names' => null, 'controlling_field_name' => null, + 'dependent_field_names' => null, 'controlling_field_value' => null ]; @@ -84,8 +84,8 @@ class PublicActionDefinitionInputFieldDependenciesInner implements ModelInterfac */ protected static array $openAPINullables = [ 'dependency_type' => false, - 'dependent_field_names' => false, 'controlling_field_name' => false, + 'dependent_field_names' => false, 'controlling_field_value' => false ]; @@ -176,8 +176,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'dependency_type' => 'dependencyType', - 'dependent_field_names' => 'dependentFieldNames', 'controlling_field_name' => 'controllingFieldName', + 'dependent_field_names' => 'dependentFieldNames', 'controlling_field_value' => 'controllingFieldValue' ]; @@ -188,8 +188,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'dependency_type' => 'setDependencyType', - 'dependent_field_names' => 'setDependentFieldNames', 'controlling_field_name' => 'setControllingFieldName', + 'dependent_field_names' => 'setDependentFieldNames', 'controlling_field_value' => 'setControllingFieldValue' ]; @@ -200,8 +200,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'dependency_type' => 'getDependencyType', - 'dependent_field_names' => 'getDependentFieldNames', 'controlling_field_name' => 'getControllingFieldName', + 'dependent_field_names' => 'getDependentFieldNames', 'controlling_field_value' => 'getControllingFieldValue' ]; @@ -270,14 +270,14 @@ public function getDependencyTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('dependency_type', $data ?? [], 'CONDITIONAL_SINGLE_FIELD'); - $this->setIfExists('dependent_field_names', $data ?? [], null); $this->setIfExists('controlling_field_name', $data ?? [], null); + $this->setIfExists('dependent_field_names', $data ?? [], null); $this->setIfExists('controlling_field_value', $data ?? [], null); } @@ -320,12 +320,12 @@ public function listInvalidProperties() ); } - if ($this->container['dependent_field_names'] === null) { - $invalidProperties[] = "'dependent_field_names' can't be null"; - } if ($this->container['controlling_field_name'] === null) { $invalidProperties[] = "'controlling_field_name' can't be null"; } + if ($this->container['dependent_field_names'] === null) { + $invalidProperties[] = "'dependent_field_names' can't be null"; + } if ($this->container['controlling_field_value'] === null) { $invalidProperties[] = "'controlling_field_value' can't be null"; } @@ -382,55 +382,55 @@ public function setDependencyType($dependency_type) } /** - * Gets dependent_field_names + * Gets controlling_field_name * - * @return string[] + * @return string */ - public function getDependentFieldNames() + public function getControllingFieldName() { - return $this->container['dependent_field_names']; + return $this->container['controlling_field_name']; } /** - * Sets dependent_field_names + * Sets controlling_field_name * - * @param string[] $dependent_field_names dependent_field_names + * @param string $controlling_field_name controlling_field_name * * @return self */ - public function setDependentFieldNames($dependent_field_names) + public function setControllingFieldName($controlling_field_name) { - if (is_null($dependent_field_names)) { - throw new \InvalidArgumentException('non-nullable dependent_field_names cannot be null'); + if (is_null($controlling_field_name)) { + throw new \InvalidArgumentException('non-nullable controlling_field_name cannot be null'); } - $this->container['dependent_field_names'] = $dependent_field_names; + $this->container['controlling_field_name'] = $controlling_field_name; return $this; } /** - * Gets controlling_field_name + * Gets dependent_field_names * - * @return string + * @return string[] */ - public function getControllingFieldName() + public function getDependentFieldNames() { - return $this->container['controlling_field_name']; + return $this->container['dependent_field_names']; } /** - * Sets controlling_field_name + * Sets dependent_field_names * - * @param string $controlling_field_name controlling_field_name + * @param string[] $dependent_field_names dependent_field_names * * @return self */ - public function setControllingFieldName($controlling_field_name) + public function setDependentFieldNames($dependent_field_names) { - if (is_null($controlling_field_name)) { - throw new \InvalidArgumentException('non-nullable controlling_field_name cannot be null'); + if (is_null($dependent_field_names)) { + throw new \InvalidArgumentException('non-nullable dependent_field_names cannot be null'); } - $this->container['controlling_field_name'] = $controlling_field_name; + $this->container['dependent_field_names'] = $dependent_field_names; return $this; } diff --git a/codegen/Automation/Actions/Model/PublicActionDefinitionPatch.php b/codegen/Automation/Actions/Model/PublicActionDefinitionPatch.php index e31547ca8..57679d5a4 100644 --- a/codegen/Automation/Actions/Model/PublicActionDefinitionPatch.php +++ b/codegen/Automation/Actions/Model/PublicActionDefinitionPatch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('input_fields', $data ?? [], null); $this->setIfExists('output_fields', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicActionFunction.php b/codegen/Automation/Actions/Model/PublicActionFunction.php index dbd598233..160afce52 100644 --- a/codegen/Automation/Actions/Model/PublicActionFunction.php +++ b/codegen/Automation/Actions/Model/PublicActionFunction.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFunctionTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('function_source', $data ?? [], null); $this->setIfExists('function_type', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicActionFunctionIdentifier.php b/codegen/Automation/Actions/Model/PublicActionFunctionIdentifier.php index d4e026429..4e372689a 100644 --- a/codegen/Automation/Actions/Model/PublicActionFunctionIdentifier.php +++ b/codegen/Automation/Actions/Model/PublicActionFunctionIdentifier.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getFunctionTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('function_type', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicActionLabels.php b/codegen/Automation/Actions/Model/PublicActionLabels.php index ee185db8e..7684f9243 100644 --- a/codegen/Automation/Actions/Model/PublicActionLabels.php +++ b/codegen/Automation/Actions/Model/PublicActionLabels.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('input_field_descriptions', $data ?? [], null); $this->setIfExists('app_display_name', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicActionRevision.php b/codegen/Automation/Actions/Model/PublicActionRevision.php index 554fc3613..ff895e9c0 100644 --- a/codegen/Automation/Actions/Model/PublicActionRevision.php +++ b/codegen/Automation/Actions/Model/PublicActionRevision.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('revision_id', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicConditionalSingleFieldDependency.php b/codegen/Automation/Actions/Model/PublicConditionalSingleFieldDependency.php index 49624ba93..785332b78 100644 --- a/codegen/Automation/Actions/Model/PublicConditionalSingleFieldDependency.php +++ b/codegen/Automation/Actions/Model/PublicConditionalSingleFieldDependency.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,9 +58,9 @@ class PublicConditionalSingleFieldDependency implements ModelInterface, ArrayAcc */ protected static $openAPITypes = [ 'dependency_type' => 'string', - 'dependent_field_names' => 'string[]', 'controlling_field_name' => 'string', - 'controlling_field_value' => 'string' + 'controlling_field_value' => 'string', + 'dependent_field_names' => 'string[]' ]; /** @@ -72,9 +72,9 @@ class PublicConditionalSingleFieldDependency implements ModelInterface, ArrayAcc */ protected static $openAPIFormats = [ 'dependency_type' => null, - 'dependent_field_names' => null, 'controlling_field_name' => null, - 'controlling_field_value' => null + 'controlling_field_value' => null, + 'dependent_field_names' => null ]; /** @@ -84,9 +84,9 @@ class PublicConditionalSingleFieldDependency implements ModelInterface, ArrayAcc */ protected static array $openAPINullables = [ 'dependency_type' => false, - 'dependent_field_names' => false, 'controlling_field_name' => false, - 'controlling_field_value' => false + 'controlling_field_value' => false, + 'dependent_field_names' => false ]; /** @@ -176,9 +176,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'dependency_type' => 'dependencyType', - 'dependent_field_names' => 'dependentFieldNames', 'controlling_field_name' => 'controllingFieldName', - 'controlling_field_value' => 'controllingFieldValue' + 'controlling_field_value' => 'controllingFieldValue', + 'dependent_field_names' => 'dependentFieldNames' ]; /** @@ -188,9 +188,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'dependency_type' => 'setDependencyType', - 'dependent_field_names' => 'setDependentFieldNames', 'controlling_field_name' => 'setControllingFieldName', - 'controlling_field_value' => 'setControllingFieldValue' + 'controlling_field_value' => 'setControllingFieldValue', + 'dependent_field_names' => 'setDependentFieldNames' ]; /** @@ -200,9 +200,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'dependency_type' => 'getDependencyType', - 'dependent_field_names' => 'getDependentFieldNames', 'controlling_field_name' => 'getControllingFieldName', - 'controlling_field_value' => 'getControllingFieldValue' + 'controlling_field_value' => 'getControllingFieldValue', + 'dependent_field_names' => 'getDependentFieldNames' ]; /** @@ -270,15 +270,15 @@ public function getDependencyTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('dependency_type', $data ?? [], 'CONDITIONAL_SINGLE_FIELD'); - $this->setIfExists('dependent_field_names', $data ?? [], null); $this->setIfExists('controlling_field_name', $data ?? [], null); $this->setIfExists('controlling_field_value', $data ?? [], null); + $this->setIfExists('dependent_field_names', $data ?? [], null); } /** @@ -320,15 +320,15 @@ public function listInvalidProperties() ); } - if ($this->container['dependent_field_names'] === null) { - $invalidProperties[] = "'dependent_field_names' can't be null"; - } if ($this->container['controlling_field_name'] === null) { $invalidProperties[] = "'controlling_field_name' can't be null"; } if ($this->container['controlling_field_value'] === null) { $invalidProperties[] = "'controlling_field_value' can't be null"; } + if ($this->container['dependent_field_names'] === null) { + $invalidProperties[] = "'dependent_field_names' can't be null"; + } return $invalidProperties; } @@ -381,33 +381,6 @@ public function setDependencyType($dependency_type) return $this; } - /** - * Gets dependent_field_names - * - * @return string[] - */ - public function getDependentFieldNames() - { - return $this->container['dependent_field_names']; - } - - /** - * Sets dependent_field_names - * - * @param string[] $dependent_field_names dependent_field_names - * - * @return self - */ - public function setDependentFieldNames($dependent_field_names) - { - if (is_null($dependent_field_names)) { - throw new \InvalidArgumentException('non-nullable dependent_field_names cannot be null'); - } - $this->container['dependent_field_names'] = $dependent_field_names; - - return $this; - } - /** * Gets controlling_field_name * @@ -461,6 +434,33 @@ public function setControllingFieldValue($controlling_field_value) return $this; } + + /** + * Gets dependent_field_names + * + * @return string[] + */ + public function getDependentFieldNames() + { + return $this->container['dependent_field_names']; + } + + /** + * Sets dependent_field_names + * + * @param string[] $dependent_field_names dependent_field_names + * + * @return self + */ + public function setDependentFieldNames($dependent_field_names) + { + if (is_null($dependent_field_names)) { + throw new \InvalidArgumentException('non-nullable dependent_field_names cannot be null'); + } + $this->container['dependent_field_names'] = $dependent_field_names; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Automation/Actions/Model/PublicExecutionTranslationRule.php b/codegen/Automation/Actions/Model/PublicExecutionTranslationRule.php index d0a6a882c..b7aca9571 100644 --- a/codegen/Automation/Actions/Model/PublicExecutionTranslationRule.php +++ b/codegen/Automation/Actions/Model/PublicExecutionTranslationRule.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('label_name', $data ?? [], null); $this->setIfExists('conditions', $data ?? [], null); diff --git a/codegen/Automation/Actions/Model/PublicObjectRequestOptions.php b/codegen/Automation/Actions/Model/PublicObjectRequestOptions.php index 69ace5931..a1b38e53c 100644 --- a/codegen/Automation/Actions/Model/PublicObjectRequestOptions.php +++ b/codegen/Automation/Actions/Model/PublicObjectRequestOptions.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties', $data ?? [], null); } diff --git a/codegen/Automation/Actions/Model/PublicSingleFieldDependency.php b/codegen/Automation/Actions/Model/PublicSingleFieldDependency.php index b9ac6af1c..5839066aa 100644 --- a/codegen/Automation/Actions/Model/PublicSingleFieldDependency.php +++ b/codegen/Automation/Actions/Model/PublicSingleFieldDependency.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ class PublicSingleFieldDependency implements ModelInterface, ArrayAccess, \JsonS */ protected static $openAPITypes = [ 'dependency_type' => 'string', - 'dependent_field_names' => 'string[]', - 'controlling_field_name' => 'string' + 'controlling_field_name' => 'string', + 'dependent_field_names' => 'string[]' ]; /** @@ -71,8 +71,8 @@ class PublicSingleFieldDependency implements ModelInterface, ArrayAccess, \JsonS */ protected static $openAPIFormats = [ 'dependency_type' => null, - 'dependent_field_names' => null, - 'controlling_field_name' => null + 'controlling_field_name' => null, + 'dependent_field_names' => null ]; /** @@ -82,8 +82,8 @@ class PublicSingleFieldDependency implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'dependency_type' => false, - 'dependent_field_names' => false, - 'controlling_field_name' => false + 'controlling_field_name' => false, + 'dependent_field_names' => false ]; /** @@ -173,8 +173,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'dependency_type' => 'dependencyType', - 'dependent_field_names' => 'dependentFieldNames', - 'controlling_field_name' => 'controllingFieldName' + 'controlling_field_name' => 'controllingFieldName', + 'dependent_field_names' => 'dependentFieldNames' ]; /** @@ -184,8 +184,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'dependency_type' => 'setDependencyType', - 'dependent_field_names' => 'setDependentFieldNames', - 'controlling_field_name' => 'setControllingFieldName' + 'controlling_field_name' => 'setControllingFieldName', + 'dependent_field_names' => 'setDependentFieldNames' ]; /** @@ -195,8 +195,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'dependency_type' => 'getDependencyType', - 'dependent_field_names' => 'getDependentFieldNames', - 'controlling_field_name' => 'getControllingFieldName' + 'controlling_field_name' => 'getControllingFieldName', + 'dependent_field_names' => 'getDependentFieldNames' ]; /** @@ -264,14 +264,14 @@ public function getDependencyTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('dependency_type', $data ?? [], 'SINGLE_FIELD'); - $this->setIfExists('dependent_field_names', $data ?? [], null); $this->setIfExists('controlling_field_name', $data ?? [], null); + $this->setIfExists('dependent_field_names', $data ?? [], null); } /** @@ -313,12 +313,12 @@ public function listInvalidProperties() ); } - if ($this->container['dependent_field_names'] === null) { - $invalidProperties[] = "'dependent_field_names' can't be null"; - } if ($this->container['controlling_field_name'] === null) { $invalidProperties[] = "'controlling_field_name' can't be null"; } + if ($this->container['dependent_field_names'] === null) { + $invalidProperties[] = "'dependent_field_names' can't be null"; + } return $invalidProperties; } @@ -372,55 +372,55 @@ public function setDependencyType($dependency_type) } /** - * Gets dependent_field_names + * Gets controlling_field_name * - * @return string[] + * @return string */ - public function getDependentFieldNames() + public function getControllingFieldName() { - return $this->container['dependent_field_names']; + return $this->container['controlling_field_name']; } /** - * Sets dependent_field_names + * Sets controlling_field_name * - * @param string[] $dependent_field_names dependent_field_names + * @param string $controlling_field_name controlling_field_name * * @return self */ - public function setDependentFieldNames($dependent_field_names) + public function setControllingFieldName($controlling_field_name) { - if (is_null($dependent_field_names)) { - throw new \InvalidArgumentException('non-nullable dependent_field_names cannot be null'); + if (is_null($controlling_field_name)) { + throw new \InvalidArgumentException('non-nullable controlling_field_name cannot be null'); } - $this->container['dependent_field_names'] = $dependent_field_names; + $this->container['controlling_field_name'] = $controlling_field_name; return $this; } /** - * Gets controlling_field_name + * Gets dependent_field_names * - * @return string + * @return string[] */ - public function getControllingFieldName() + public function getDependentFieldNames() { - return $this->container['controlling_field_name']; + return $this->container['dependent_field_names']; } /** - * Sets controlling_field_name + * Sets dependent_field_names * - * @param string $controlling_field_name controlling_field_name + * @param string[] $dependent_field_names dependent_field_names * * @return self */ - public function setControllingFieldName($controlling_field_name) + public function setDependentFieldNames($dependent_field_names) { - if (is_null($controlling_field_name)) { - throw new \InvalidArgumentException('non-nullable controlling_field_name cannot be null'); + if (is_null($dependent_field_names)) { + throw new \InvalidArgumentException('non-nullable dependent_field_names cannot be null'); } - $this->container['controlling_field_name'] = $controlling_field_name; + $this->container['dependent_field_names'] = $dependent_field_names; return $this; } diff --git a/codegen/Automation/Actions/ObjectSerializer.php b/codegen/Automation/Actions/ObjectSerializer.php index 75f9de691..277ae0fc1 100644 --- a/codegen/Automation/Actions/ObjectSerializer.php +++ b/codegen/Automation/Actions/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/AuditLogs/Api/AuditLogsApi.php b/codegen/Cms/AuditLogs/Api/AuditLogsApi.php index 4ed98e543..69f1e7682 100644 --- a/codegen/Cms/AuditLogs/Api/AuditLogsApi.php +++ b/codegen/Cms/AuditLogs/Api/AuditLogsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class AuditLogsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -127,14 +127,14 @@ public function getConfig() * * Query audit logs * - * @param string[] $user_id Comma separated list of user ids to filter by. (optional) - * @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) - * @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) - * @param string[] $object_id Comma separated list of object ids to filter by. (optional) - * @param string $after Timestamp after which audit logs will be returned (optional) - * @param string $before Timestamp before which audit logs will be returned (optional) - * @param int $limit The number of logs to return. (optional) - * @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) + * @param string[]|null $user_id Comma separated list of user ids to filter by. (optional) + * @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) + * @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) + * @param string[]|null $object_id Comma separated list of object ids to filter by. (optional) + * @param string|null $after Timestamp after which audit logs will be returned (optional) + * @param string|null $before Timestamp before which audit logs will be returned (optional) + * @param int|null $limit The number of logs to return. (optional) + * @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\AuditLogs\ApiException on non-2xx response or if the response body is not in the expected format @@ -152,14 +152,14 @@ public function getPage($user_id = null, $event_type = null, $object_type = null * * Query audit logs * - * @param string[] $user_id Comma separated list of user ids to filter by. (optional) - * @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) - * @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) - * @param string[] $object_id Comma separated list of object ids to filter by. (optional) - * @param string $after Timestamp after which audit logs will be returned (optional) - * @param string $before Timestamp before which audit logs will be returned (optional) - * @param int $limit The number of logs to return. (optional) - * @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) + * @param string[]|null $user_id Comma separated list of user ids to filter by. (optional) + * @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) + * @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) + * @param string[]|null $object_id Comma separated list of object ids to filter by. (optional) + * @param string|null $after Timestamp after which audit logs will be returned (optional) + * @param string|null $before Timestamp before which audit logs will be returned (optional) + * @param int|null $limit The number of logs to return. (optional) + * @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\AuditLogs\ApiException on non-2xx response or if the response body is not in the expected format @@ -192,18 +192,6 @@ public function getPageWithHttpInfo($user_id = null, $event_type = null, $object $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -262,6 +250,19 @@ public function getPageWithHttpInfo($user_id = null, $event_type = null, $object ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\AuditLogs\Model\CollectionResponsePublicAuditLog'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -318,14 +319,14 @@ public function getPageWithHttpInfo($user_id = null, $event_type = null, $object * * Query audit logs * - * @param string[] $user_id Comma separated list of user ids to filter by. (optional) - * @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) - * @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) - * @param string[] $object_id Comma separated list of object ids to filter by. (optional) - * @param string $after Timestamp after which audit logs will be returned (optional) - * @param string $before Timestamp before which audit logs will be returned (optional) - * @param int $limit The number of logs to return. (optional) - * @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) + * @param string[]|null $user_id Comma separated list of user ids to filter by. (optional) + * @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) + * @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) + * @param string[]|null $object_id Comma separated list of object ids to filter by. (optional) + * @param string|null $after Timestamp after which audit logs will be returned (optional) + * @param string|null $before Timestamp before which audit logs will be returned (optional) + * @param int|null $limit The number of logs to return. (optional) + * @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -346,14 +347,14 @@ function ($response) { * * Query audit logs * - * @param string[] $user_id Comma separated list of user ids to filter by. (optional) - * @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) - * @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) - * @param string[] $object_id Comma separated list of object ids to filter by. (optional) - * @param string $after Timestamp after which audit logs will be returned (optional) - * @param string $before Timestamp before which audit logs will be returned (optional) - * @param int $limit The number of logs to return. (optional) - * @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) + * @param string[]|null $user_id Comma separated list of user ids to filter by. (optional) + * @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) + * @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) + * @param string[]|null $object_id Comma separated list of object ids to filter by. (optional) + * @param string|null $after Timestamp after which audit logs will be returned (optional) + * @param string|null $before Timestamp before which audit logs will be returned (optional) + * @param int|null $limit The number of logs to return. (optional) + * @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -403,14 +404,14 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string[] $user_id Comma separated list of user ids to filter by. (optional) - * @param string[] $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) - * @param string[] $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) - * @param string[] $object_id Comma separated list of object ids to filter by. (optional) - * @param string $after Timestamp after which audit logs will be returned (optional) - * @param string $before Timestamp before which audit logs will be returned (optional) - * @param int $limit The number of logs to return. (optional) - * @param string[] $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) + * @param string[]|null $user_id Comma separated list of user ids to filter by. (optional) + * @param string[]|null $event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). (optional) + * @param string[]|null $object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) (optional) + * @param string[]|null $object_id Comma separated list of object ids to filter by. (optional) + * @param string|null $after Timestamp after which audit logs will be returned (optional) + * @param string|null $before Timestamp before which audit logs will be returned (optional) + * @param int|null $limit The number of logs to return. (optional) + * @param string[]|null $sort The sort direction for the audit logs. (Can only sort by timestamp). (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Cms/AuditLogs/ApiException.php b/codegen/Cms/AuditLogs/ApiException.php index 0a167a692..771d4638e 100644 --- a/codegen/Cms/AuditLogs/ApiException.php +++ b/codegen/Cms/AuditLogs/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/AuditLogs/Configuration.php b/codegen/Cms/AuditLogs/Configuration.php index a7b86fbf0..7d0293e68 100644 --- a/codegen/Cms/AuditLogs/Configuration.php +++ b/codegen/Cms/AuditLogs/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/AuditLogs/HeaderSelector.php b/codegen/Cms/AuditLogs/HeaderSelector.php index a4dacb4eb..9ca182727 100644 --- a/codegen/Cms/AuditLogs/HeaderSelector.php +++ b/codegen/Cms/AuditLogs/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/AuditLogs/Model/CollectionResponsePublicAuditLog.php b/codegen/Cms/AuditLogs/Model/CollectionResponsePublicAuditLog.php index 26394c14d..af39e09f7 100644 --- a/codegen/Cms/AuditLogs/Model/CollectionResponsePublicAuditLog.php +++ b/codegen/Cms/AuditLogs/Model/CollectionResponsePublicAuditLog.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Cms/AuditLogs/Model/Error.php b/codegen/Cms/AuditLogs/Model/Error.php index b2a6eab26..692d525f3 100644 --- a/codegen/Cms/AuditLogs/Model/Error.php +++ b/codegen/Cms/AuditLogs/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/AuditLogs/Model/ErrorDetail.php b/codegen/Cms/AuditLogs/Model/ErrorDetail.php index 3279d5276..bf29abe92 100644 --- a/codegen/Cms/AuditLogs/Model/ErrorDetail.php +++ b/codegen/Cms/AuditLogs/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/AuditLogs/Model/ModelInterface.php b/codegen/Cms/AuditLogs/Model/ModelInterface.php index 6dd972f76..b8763cda4 100644 --- a/codegen/Cms/AuditLogs/Model/ModelInterface.php +++ b/codegen/Cms/AuditLogs/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/AuditLogs/Model/NextPage.php b/codegen/Cms/AuditLogs/Model/NextPage.php index 57acee4ea..a3cd3d2b8 100644 --- a/codegen/Cms/AuditLogs/Model/NextPage.php +++ b/codegen/Cms/AuditLogs/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/AuditLogs/Model/Paging.php b/codegen/Cms/AuditLogs/Model/Paging.php index d39b36c99..94d80d88f 100644 --- a/codegen/Cms/AuditLogs/Model/Paging.php +++ b/codegen/Cms/AuditLogs/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Cms/AuditLogs/Model/PreviousPage.php b/codegen/Cms/AuditLogs/Model/PreviousPage.php index 5929e5958..b48b021db 100644 --- a/codegen/Cms/AuditLogs/Model/PreviousPage.php +++ b/codegen/Cms/AuditLogs/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Cms/AuditLogs/Model/PublicAuditLog.php b/codegen/Cms/AuditLogs/Model/PublicAuditLog.php index 1eb62a3c8..168b0450a 100644 --- a/codegen/Cms/AuditLogs/Model/PublicAuditLog.php +++ b/codegen/Cms/AuditLogs/Model/PublicAuditLog.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -355,10 +355,10 @@ public function getObjectTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('meta', $data ?? [], null); $this->setIfExists('object_name', $data ?? [], null); diff --git a/codegen/Cms/AuditLogs/ObjectSerializer.php b/codegen/Cms/AuditLogs/ObjectSerializer.php index b7987d3df..ee4e0bbd3 100644 --- a/codegen/Cms/AuditLogs/ObjectSerializer.php +++ b/codegen/Cms/AuditLogs/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php b/codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php index 16c468ea3..bf954514b 100644 --- a/codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php +++ b/codegen/Cms/Blogs/Authors/Api/BlogAuthorsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -122,13 +122,13 @@ class BlogAuthorsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -167,7 +167,7 @@ public function getConfig() * Delete a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -185,7 +185,7 @@ public function archive($object_id, $archived = null, string $contentType = self * Delete a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -218,18 +218,6 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -254,7 +242,7 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten * Delete a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -276,7 +264,7 @@ function ($response) { * Delete a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -314,7 +302,7 @@ function ($exception) { * Create request for operation 'archive' * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -472,18 +460,6 @@ public function archiveBatchWithHttpInfo($batch_input_string, string $contentTyp $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -712,18 +688,6 @@ public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -953,18 +917,6 @@ public function createWithHttpInfo($blog_author, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -1023,6 +975,19 @@ public function createWithHttpInfo($blog_author, string $contentType = self::con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1298,18 +1263,6 @@ public function createBatchWithHttpInfo($batch_input_blog_author, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -1395,6 +1348,19 @@ public function createBatchWithHttpInfo($batch_input_blog_author, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1678,18 +1644,6 @@ public function createLangVariationWithHttpInfo($blog_author_clone_request_v_nex $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1748,6 +1702,19 @@ public function createLangVariationWithHttpInfo($blog_author_clone_request_v_nex ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2022,18 +1989,6 @@ public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -2213,8 +2168,8 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex * Retrieve a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -2233,8 +2188,8 @@ public function getById($object_id, $archived = null, $property = null, string $ * Retrieve a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -2267,18 +2222,6 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2337,6 +2280,19 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2394,8 +2350,8 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu * Retrieve a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2417,8 +2373,8 @@ function ($response) { * Retrieve a Blog Author * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2469,8 +2425,8 @@ function ($exception) { * Create request for operation 'getById' * * @param string $object_id The Blog Author id. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2588,17 +2544,17 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s * * Get all Blog Authors * - * @param \DateTime $created_at Only return Blog Authors created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Authors created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Authors created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Authors last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Authors last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param \DateTime|null $created_at Only return Blog Authors created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Authors created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Authors created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Authors last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Authors last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -2616,17 +2572,17 @@ public function getPage($created_at = null, $created_after = null, $created_befo * * Get all Blog Authors * - * @param \DateTime $created_at Only return Blog Authors created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Authors created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Authors created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Authors last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Authors last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Authors created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Authors created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Authors created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Authors last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Authors last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -2659,18 +2615,6 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2729,6 +2673,19 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\CollectionResponseWithTotalBlogAuthorForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2785,17 +2742,17 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ * * Get all Blog Authors * - * @param \DateTime $created_at Only return Blog Authors created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Authors created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Authors created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Authors last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Authors last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Authors created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Authors created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Authors created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Authors last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Authors last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2816,17 +2773,17 @@ function ($response) { * * Get all Blog Authors * - * @param \DateTime $created_at Only return Blog Authors created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Authors created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Authors created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Authors last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Authors last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Authors created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Authors created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Authors created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Authors last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Authors last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2876,17 +2833,17 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param \DateTime $created_at Only return Blog Authors created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Authors created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Authors created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Authors last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Authors last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Authors created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Authors created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Authors created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Authors last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Authors last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Authors last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3080,7 +3037,7 @@ public function getPageRequest($created_at = null, $created_after = null, $creat * Retrieve a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -3099,7 +3056,7 @@ public function readBatch($batch_input_string, $archived = null, string $content * Retrieve a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -3132,18 +3089,6 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3229,6 +3174,19 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3294,7 +3252,7 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str * Retrieve a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3316,7 +3274,7 @@ function ($response) { * Retrieve a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3367,7 +3325,7 @@ function ($exception) { * Create request for operation 'readBatch' * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputString $batch_input_string The JSON array of Blog Author ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3524,18 +3482,6 @@ public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_n $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -3716,7 +3662,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, * * @param string $object_id The Blog Author id. (required) * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of the updated Blog Author. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -3736,7 +3682,7 @@ public function update($object_id, $blog_author, $archived = null, string $conte * * @param string $object_id The Blog Author id. (required) * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of the updated Blog Author. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -3769,18 +3715,6 @@ public function updateWithHttpInfo($object_id, $blog_author, $archived = null, s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3839,6 +3773,19 @@ public function updateWithHttpInfo($object_id, $blog_author, $archived = null, s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3897,7 +3844,7 @@ public function updateWithHttpInfo($object_id, $blog_author, $archived = null, s * * @param string $object_id The Blog Author id. (required) * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of the updated Blog Author. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3920,7 +3867,7 @@ function ($response) { * * @param string $object_id The Blog Author id. (required) * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of the updated Blog Author. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3972,7 +3919,7 @@ function ($exception) { * * @param string $object_id The Blog Author id. (required) * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BlogAuthor $blog_author The JSON representation of the updated Blog Author. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4095,7 +4042,7 @@ public function updateRequest($object_id, $blog_author, $archived = null, string * Update a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Authors. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -4114,7 +4061,7 @@ public function updateBatch($batch_input_json_node, $archived = null, string $co * Update a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Authors. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Authors\ApiException on non-2xx response or if the response body is not in the expected format @@ -4147,18 +4094,6 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4244,6 +4179,19 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Authors\Model\BatchResponseBlogAuthor'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4309,7 +4257,7 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null * Update a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Authors. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4331,7 +4279,7 @@ function ($response) { * Update a batch of Blog Authors * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Authors. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4382,7 +4330,7 @@ function ($exception) { * Create request for operation 'updateBatch' * * @param \HubSpot\Client\Cms\Blogs\Authors\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Authors. (required) - * @param bool $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Authors. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4539,18 +4487,6 @@ public function updateLangsWithHttpInfo($update_languages_request_v_next, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; diff --git a/codegen/Cms/Blogs/Authors/ApiException.php b/codegen/Cms/Blogs/Authors/ApiException.php index 9511f62f3..66afcea3d 100644 --- a/codegen/Cms/Blogs/Authors/ApiException.php +++ b/codegen/Cms/Blogs/Authors/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/Blogs/Authors/Configuration.php b/codegen/Cms/Blogs/Authors/Configuration.php index 4eb941358..68e8ace76 100644 --- a/codegen/Cms/Blogs/Authors/Configuration.php +++ b/codegen/Cms/Blogs/Authors/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/Blogs/Authors/HeaderSelector.php b/codegen/Cms/Blogs/Authors/HeaderSelector.php index c93c6e08c..2497f4777 100644 --- a/codegen/Cms/Blogs/Authors/HeaderSelector.php +++ b/codegen/Cms/Blogs/Authors/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/Blogs/Authors/Model/AttachToLangPrimaryRequestVNext.php b/codegen/Cms/Blogs/Authors/Model/AttachToLangPrimaryRequestVNext.php index 7501dbc99..cb82f8a88 100644 --- a/codegen/Cms/Blogs/Authors/Model/AttachToLangPrimaryRequestVNext.php +++ b/codegen/Cms/Blogs/Authors/Model/AttachToLangPrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('language', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/BatchInputBlogAuthor.php b/codegen/Cms/Blogs/Authors/Model/BatchInputBlogAuthor.php index f445353a9..f54f3c136 100644 --- a/codegen/Cms/Blogs/Authors/Model/BatchInputBlogAuthor.php +++ b/codegen/Cms/Blogs/Authors/Model/BatchInputBlogAuthor.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Authors/Model/BatchInputJsonNode.php b/codegen/Cms/Blogs/Authors/Model/BatchInputJsonNode.php index cf6ece492..5f7db7c9e 100644 --- a/codegen/Cms/Blogs/Authors/Model/BatchInputJsonNode.php +++ b/codegen/Cms/Blogs/Authors/Model/BatchInputJsonNode.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Authors/Model/BatchInputString.php b/codegen/Cms/Blogs/Authors/Model/BatchInputString.php index b90248d17..1004e6b5e 100644 --- a/codegen/Cms/Blogs/Authors/Model/BatchInputString.php +++ b/codegen/Cms/Blogs/Authors/Model/BatchInputString.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthor.php b/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthor.php index d5e6df6ca..52306fc18 100644 --- a/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthor.php +++ b/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthor.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -289,10 +289,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthorWithErrors.php b/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthorWithErrors.php index 28937dae7..14efe46ae 100644 --- a/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthorWithErrors.php +++ b/codegen/Cms/Blogs/Authors/Model/BatchResponseBlogAuthorWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -301,10 +301,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/BlogAuthor.php b/codegen/Cms/Blogs/Authors/Model/BlogAuthor.php index ad6e9ffb1..1d44f03c6 100644 --- a/codegen/Cms/Blogs/Authors/Model/BlogAuthor.php +++ b/codegen/Cms/Blogs/Authors/Model/BlogAuthor.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -1855,10 +1855,10 @@ public function getLanguageAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('website', $data ?? [], null); $this->setIfExists('display_name', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/BlogAuthorCloneRequestVNext.php b/codegen/Cms/Blogs/Authors/Model/BlogAuthorCloneRequestVNext.php index fa1aa9a7b..a3cb73aa2 100644 --- a/codegen/Cms/Blogs/Authors/Model/BlogAuthorCloneRequestVNext.php +++ b/codegen/Cms/Blogs/Authors/Model/BlogAuthorCloneRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('language', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/CollectionResponseWithTotalBlogAuthorForwardPaging.php b/codegen/Cms/Blogs/Authors/Model/CollectionResponseWithTotalBlogAuthorForwardPaging.php index e00520907..55414c594 100644 --- a/codegen/Cms/Blogs/Authors/Model/CollectionResponseWithTotalBlogAuthorForwardPaging.php +++ b/codegen/Cms/Blogs/Authors/Model/CollectionResponseWithTotalBlogAuthorForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/DetachFromLangGroupRequestVNext.php b/codegen/Cms/Blogs/Authors/Model/DetachFromLangGroupRequestVNext.php index 84ddf8260..5df181a26 100644 --- a/codegen/Cms/Blogs/Authors/Model/DetachFromLangGroupRequestVNext.php +++ b/codegen/Cms/Blogs/Authors/Model/DetachFromLangGroupRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Authors/Model/Error.php b/codegen/Cms/Blogs/Authors/Model/Error.php index c560b1fce..14b6d35ed 100644 --- a/codegen/Cms/Blogs/Authors/Model/Error.php +++ b/codegen/Cms/Blogs/Authors/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/ErrorDetail.php b/codegen/Cms/Blogs/Authors/Model/ErrorDetail.php index 7c11c5d70..0c4e70923 100644 --- a/codegen/Cms/Blogs/Authors/Model/ErrorDetail.php +++ b/codegen/Cms/Blogs/Authors/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/ForwardPaging.php b/codegen/Cms/Blogs/Authors/Model/ForwardPaging.php index 5adb93e1a..4e8d2fa03 100644 --- a/codegen/Cms/Blogs/Authors/Model/ForwardPaging.php +++ b/codegen/Cms/Blogs/Authors/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Authors/Model/ModelInterface.php b/codegen/Cms/Blogs/Authors/Model/ModelInterface.php index 0042e0fdb..036003058 100644 --- a/codegen/Cms/Blogs/Authors/Model/ModelInterface.php +++ b/codegen/Cms/Blogs/Authors/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/Blogs/Authors/Model/NextPage.php b/codegen/Cms/Blogs/Authors/Model/NextPage.php index e2f81025d..212121b87 100644 --- a/codegen/Cms/Blogs/Authors/Model/NextPage.php +++ b/codegen/Cms/Blogs/Authors/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/SetNewLanguagePrimaryRequestVNext.php b/codegen/Cms/Blogs/Authors/Model/SetNewLanguagePrimaryRequestVNext.php index 84e2c0fe2..0323e005f 100644 --- a/codegen/Cms/Blogs/Authors/Model/SetNewLanguagePrimaryRequestVNext.php +++ b/codegen/Cms/Blogs/Authors/Model/SetNewLanguagePrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Authors/Model/StandardError.php b/codegen/Cms/Blogs/Authors/Model/StandardError.php index a130e38eb..0aa354f4c 100644 --- a/codegen/Cms/Blogs/Authors/Model/StandardError.php +++ b/codegen/Cms/Blogs/Authors/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/Model/UpdateLanguagesRequestVNext.php b/codegen/Cms/Blogs/Authors/Model/UpdateLanguagesRequestVNext.php index 4a3facc66..0b9d1311d 100644 --- a/codegen/Cms/Blogs/Authors/Model/UpdateLanguagesRequestVNext.php +++ b/codegen/Cms/Blogs/Authors/Model/UpdateLanguagesRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('languages', $data ?? [], null); $this->setIfExists('primary_id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Authors/ObjectSerializer.php b/codegen/Cms/Blogs/Authors/ObjectSerializer.php index 8d16e5011..fe3700083 100644 --- a/codegen/Cms/Blogs/Authors/ObjectSerializer.php +++ b/codegen/Cms/Blogs/Authors/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/Blogs/BlogPosts/Api/BlogPostsApi.php b/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php similarity index 59% rename from codegen/Cms/Blogs/BlogPosts/Api/BlogPostsApi.php rename to codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php index fe3b75f74..928927e19 100644 --- a/codegen/Cms/Blogs/BlogPosts/Api/BlogPostsApi.php +++ b/codegen/Cms/Blogs/BlogPosts/Api/BasicApi.php @@ -1,6 +1,6 @@ [ 'application/json', ], - 'archiveBatch' => [ - 'application/json', - ], - 'attachToLangGroup' => [ - 'application/json', - ], 'callClone' => [ 'application/json', ], 'create' => [ 'application/json', ], - 'createBatch' => [ - 'application/json', - ], - 'createLangVariation' => [ - 'application/json', - ], - 'detachFromLangGroup' => [ - 'application/json', - ], 'getById' => [ 'application/json', ], @@ -113,9 +98,6 @@ class BlogPostsApi 'pushLive' => [ 'application/json', ], - 'readBatch' => [ - 'application/json', - ], 'resetDraft' => [ 'application/json', ], @@ -128,21 +110,12 @@ class BlogPostsApi 'schedule' => [ 'application/json', ], - 'setLangPrimary' => [ - 'application/json', - ], 'update' => [ 'application/json', ], - 'updateBatch' => [ - 'application/json', - ], 'updateDraft' => [ 'application/json', ], - 'updateLangs' => [ - 'application/json', - ], ]; /** @@ -152,13 +125,13 @@ class BlogPostsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -194,10 +167,10 @@ public function getConfig() /** * Operation archive * - * Delete a Blog Post + * Delete a blog post * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $object_id The ID of the blog post to delete. (required) + * @param bool|null $archived Whether to return only results that have been deleted. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format @@ -212,10 +185,10 @@ public function archive($object_id, $archived = null, string $contentType = self /** * Operation archiveWithHttpInfo * - * Delete a Blog Post + * Delete a blog post * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $object_id The ID of the blog post to delete. (required) + * @param bool|null $archived Whether to return only results that have been deleted. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format @@ -248,18 +221,6 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -281,10 +242,10 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten /** * Operation archiveAsync * - * Delete a Blog Post + * Delete a blog post * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $object_id The ID of the blog post to delete. (required) + * @param bool|null $archived Whether to return only results that have been deleted. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -303,10 +264,10 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Delete a Blog Post + * Delete a blog post * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $object_id The ID of the blog post to delete. (required) + * @param bool|null $archived Whether to return only results that have been deleted. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -343,8 +304,8 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param string $object_id The ID of the blog post to delete. (required) + * @param bool|null $archived Whether to return only results that have been deleted. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -448,37 +409,38 @@ public function archiveRequest($object_id, $archived = null, string $contentType } /** - * Operation archiveBatch + * Operation callClone * - * Delete a batch of Blog Posts + * Clone a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function archiveBatch($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) + public function callClone($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) { - $this->archiveBatchWithHttpInfo($batch_input_string, $contentType); + list($response) = $this->callCloneWithHttpInfo($content_clone_request_v_next, $contentType); + return $response; } /** - * Operation archiveBatchWithHttpInfo + * Operation callCloneWithHttpInfo * - * Delete a batch of Blog Posts + * Clone a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function archiveBatchWithHttpInfo($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) + public function callCloneWithHttpInfo($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) { - $request = $this->archiveBatchRequest($batch_input_string, $contentType); + $request = $this->callCloneRequest($content_clone_request_v_next, $contentType); try { $options = $this->createHttpClientOption(); @@ -502,6 +464,64 @@ public function archiveBatchWithHttpInfo($batch_input_string, string $contentTyp $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -515,10 +535,44 @@ public function archiveBatchWithHttpInfo($batch_input_string, string $contentTyp ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + 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() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -533,19 +587,19 @@ public function archiveBatchWithHttpInfo($batch_input_string, string $contentTyp } /** - * Operation archiveBatchAsync + * Operation callCloneAsync * - * Delete a batch of Blog Posts + * Clone a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveBatchAsync($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) + public function callCloneAsync($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) { - return $this->archiveBatchAsyncWithHttpInfo($batch_input_string, $contentType) + return $this->callCloneAsyncWithHttpInfo($content_clone_request_v_next, $contentType) ->then( function ($response) { return $response[0]; @@ -554,26 +608,39 @@ function ($response) { } /** - * Operation archiveBatchAsyncWithHttpInfo + * Operation callCloneAsyncWithHttpInfo * - * Delete a batch of Blog Posts + * Clone a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveBatchAsyncWithHttpInfo($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) + public function callCloneAsyncWithHttpInfo($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) { - $returnType = ''; - $request = $this->archiveBatchRequest($batch_input_string, $contentType); + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + $request = $this->callCloneRequest($content_clone_request_v_next, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -593,26 +660,26 @@ function ($exception) { } /** - * Create request for operation 'archiveBatch' + * Create request for operation 'callClone' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveBatchRequest($batch_input_string, string $contentType = self::contentTypes['archiveBatch'][0]) + public function callCloneRequest($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) { - // verify the required parameter 'batch_input_string' is set - if ($batch_input_string === null || (is_array($batch_input_string) && count($batch_input_string) === 0)) { + // verify the required parameter 'content_clone_request_v_next' is set + if ($content_clone_request_v_next === null || (is_array($content_clone_request_v_next) && count($content_clone_request_v_next) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_string when calling archiveBatch' + 'Missing the required parameter $content_clone_request_v_next when calling callClone' ); } - $resourcePath = '/cms/v3/blogs/posts/batch/archive'; + $resourcePath = '/cms/v3/blogs/posts/clone'; $formParams = []; $queryParams = []; $headerParams = []; @@ -624,18 +691,18 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (isset($batch_input_string)) { + if (isset($content_clone_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_string)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next)); } else { - $httpBody = $batch_input_string; + $httpBody = $content_clone_request_v_next; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -688,37 +755,38 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s } /** - * Operation attachToLangGroup + * Operation create * - * Attach a Blog Post to a multi-language group + * Create a new post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function attachToLangGroup($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + public function create($blog_post, string $contentType = self::contentTypes['create'][0]) { - $this->attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_next, $contentType); + list($response) = $this->createWithHttpInfo($blog_post, $contentType); + return $response; } /** - * Operation attachToLangGroupWithHttpInfo + * Operation createWithHttpInfo * - * Attach a Blog Post to a multi-language group + * Create a new post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + public function createWithHttpInfo($blog_post, string $contentType = self::contentTypes['create'][0]) { - $request = $this->attachToLangGroupRequest($attach_to_lang_primary_request_v_next, $contentType); + $request = $this->createRequest($blog_post, $contentType); try { $options = $this->createHttpClientOption(); @@ -742,6 +810,64 @@ public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_ $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -755,10 +881,44 @@ public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_ ); } - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -773,19 +933,19 @@ public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_ } /** - * Operation attachToLangGroupAsync + * Operation createAsync * - * Attach a Blog Post to a multi-language group + * Create a new post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function attachToLangGroupAsync($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + public function createAsync($blog_post, string $contentType = self::contentTypes['create'][0]) { - return $this->attachToLangGroupAsyncWithHttpInfo($attach_to_lang_primary_request_v_next, $contentType) + return $this->createAsyncWithHttpInfo($blog_post, $contentType) ->then( function ($response) { return $response[0]; @@ -794,26 +954,39 @@ function ($response) { } /** - * Operation attachToLangGroupAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Attach a Blog Post to a multi-language group + * Create a new post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function attachToLangGroupAsyncWithHttpInfo($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + public function createAsyncWithHttpInfo($blog_post, string $contentType = self::contentTypes['create'][0]) { - $returnType = ''; - $request = $this->attachToLangGroupRequest($attach_to_lang_primary_request_v_next, $contentType); + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + $request = $this->createRequest($blog_post, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -833,26 +1006,26 @@ function ($exception) { } /** - * Create request for operation 'attachToLangGroup' + * Create request for operation 'create' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + public function createRequest($blog_post, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'attach_to_lang_primary_request_v_next' is set - if ($attach_to_lang_primary_request_v_next === null || (is_array($attach_to_lang_primary_request_v_next) && count($attach_to_lang_primary_request_v_next) === 0)) { + // verify the required parameter 'blog_post' is set + if ($blog_post === null || (is_array($blog_post) && count($blog_post) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $attach_to_lang_primary_request_v_next when calling attachToLangGroup' + 'Missing the required parameter $blog_post when calling create' ); } - $resourcePath = '/cms/v3/blogs/posts/multi-language/attach-to-lang-group'; + $resourcePath = '/cms/v3/blogs/posts'; $formParams = []; $queryParams = []; $headerParams = []; @@ -864,18 +1037,18 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (isset($attach_to_lang_primary_request_v_next)) { + if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($blog_post)); } else { - $httpBody = $attach_to_lang_primary_request_v_next; + $httpBody = $blog_post; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -928,38 +1101,42 @@ public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, } /** - * Operation callClone + * Operation getById * - * Clone a Blog Post + * Retrieve a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property Specific properties to return. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function callClone($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + public function getById($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->callCloneWithHttpInfo($content_clone_request_v_next, $contentType); + list($response) = $this->getByIdWithHttpInfo($object_id, $archived, $property, $contentType); return $response; } /** - * Operation callCloneWithHttpInfo + * Operation getByIdWithHttpInfo * - * Clone a Blog Post + * Retrieve a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property Specific properties to return. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function callCloneWithHttpInfo($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + public function getByIdWithHttpInfo($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->callCloneRequest($content_clone_request_v_next, $contentType); + $request = $this->getByIdRequest($object_id, $archived, $property, $contentType); try { $options = $this->createHttpClientOption(); @@ -983,18 +1160,6 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1053,6 +1218,19 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1105,19 +1283,21 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con } /** - * Operation callCloneAsync + * Operation getByIdAsync * - * Clone a Blog Post + * Retrieve a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property Specific properties to return. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function callCloneAsync($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + public function getByIdAsync($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->callCloneAsyncWithHttpInfo($content_clone_request_v_next, $contentType) + return $this->getByIdAsyncWithHttpInfo($object_id, $archived, $property, $contentType) ->then( function ($response) { return $response[0]; @@ -1126,20 +1306,22 @@ function ($response) { } /** - * Operation callCloneAsyncWithHttpInfo + * Operation getByIdAsyncWithHttpInfo * - * Clone a Blog Post + * Retrieve a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property Specific properties to return. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function callCloneAsyncWithHttpInfo($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + public function getByIdAsyncWithHttpInfo($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->callCloneRequest($content_clone_request_v_next, $contentType); + $request = $this->getByIdRequest($object_id, $archived, $property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1178,34 +1360,64 @@ function ($exception) { } /** - * Create request for operation 'callClone' + * Create request for operation 'getById' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentCloneRequestVNext $content_clone_request_v_next The JSON representation of the ContentCloneRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['callClone'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property Specific properties to return. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function callCloneRequest($content_clone_request_v_next, string $contentType = self::contentTypes['callClone'][0]) + public function getByIdRequest($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) { - // verify the required parameter 'content_clone_request_v_next' is set - if ($content_clone_request_v_next === null || (is_array($content_clone_request_v_next) && count($content_clone_request_v_next) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $content_clone_request_v_next when calling callClone' + 'Missing the required parameter $object_id when calling getById' ); } - $resourcePath = '/cms/v3/blogs/posts/clone'; + + + $resourcePath = '/cms/v3/blogs/posts/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $property, + 'property', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -1215,14 +1427,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT ); // for model (json/xml) - if (isset($content_clone_request_v_next)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($content_clone_request_v_next)); - } else { - $httpBody = $content_clone_request_v_next; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1265,7 +1470,7 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1273,38 +1478,38 @@ public function callCloneRequest($content_clone_request_v_next, string $contentT } /** - * Operation create + * Operation getDraftById * - * Create a new Blog Post + * Retrieve the full draft version of the Blog Post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve the draft of. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function create($blog_post, string $contentType = self::contentTypes['create'][0]) + public function getDraftById($object_id, string $contentType = self::contentTypes['getDraftById'][0]) { - list($response) = $this->createWithHttpInfo($blog_post, $contentType); + list($response) = $this->getDraftByIdWithHttpInfo($object_id, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation getDraftByIdWithHttpInfo * - * Create a new Blog Post + * Retrieve the full draft version of the Blog Post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve the draft of. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($blog_post, string $contentType = self::contentTypes['create'][0]) + public function getDraftByIdWithHttpInfo($object_id, string $contentType = self::contentTypes['getDraftById'][0]) { - $request = $this->createRequest($blog_post, $contentType); + $request = $this->getDraftByIdRequest($object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1328,21 +1533,9 @@ public function createWithHttpInfo($blog_post, string $contentType = self::conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { - case 201: + case 200: if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1398,6 +1591,19 @@ public function createWithHttpInfo($blog_post, string $contentType = self::conte ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1428,7 +1634,7 @@ public function createWithHttpInfo($blog_post, string $contentType = self::conte } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', @@ -1450,19 +1656,19 @@ public function createWithHttpInfo($blog_post, string $contentType = self::conte } /** - * Operation createAsync + * Operation getDraftByIdAsync * - * Create a new Blog Post + * Retrieve the full draft version of the Blog Post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve the draft of. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($blog_post, string $contentType = self::contentTypes['create'][0]) + public function getDraftByIdAsync($object_id, string $contentType = self::contentTypes['getDraftById'][0]) { - return $this->createAsyncWithHttpInfo($blog_post, $contentType) + return $this->getDraftByIdAsyncWithHttpInfo($object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1471,20 +1677,20 @@ function ($response) { } /** - * Operation createAsyncWithHttpInfo + * Operation getDraftByIdAsyncWithHttpInfo * - * Create a new Blog Post + * Retrieve the full draft version of the Blog Post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve the draft of. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($blog_post, string $contentType = self::contentTypes['create'][0]) + public function getDraftByIdAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['getDraftById'][0]) { $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->createRequest($blog_post, $contentType); + $request = $this->getDraftByIdRequest($object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1523,26 +1729,26 @@ function ($exception) { } /** - * Create request for operation 'create' + * Create request for operation 'getDraftById' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of a new Blog Post. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve the draft of. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($blog_post, string $contentType = self::contentTypes['create'][0]) + public function getDraftByIdRequest($object_id, string $contentType = self::contentTypes['getDraftById'][0]) { - // verify the required parameter 'blog_post' is set - if ($blog_post === null || (is_array($blog_post) && count($blog_post) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $blog_post when calling create' + 'Missing the required parameter $object_id when calling getDraftById' ); } - $resourcePath = '/cms/v3/blogs/posts'; + $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1551,6 +1757,14 @@ public function createRequest($blog_post, string $contentType = self::contentTyp + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -1560,14 +1774,7 @@ public function createRequest($blog_post, string $contentType = self::contentTyp ); // for model (json/xml) - if (isset($blog_post)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($blog_post)); - } else { - $httpBody = $blog_post; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1610,7 +1817,7 @@ public function createRequest($blog_post, string $contentType = self::contentTyp $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1618,38 +1825,58 @@ public function createRequest($blog_post, string $contentType = self::contentTyp } /** - * Operation createBatch - * - * Create a batch of Blog Posts + * Operation getPage * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation + * Get all posts + * + * @param \DateTime|null $created_at Only return blog posts created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return blog posts created after the specified time. (optional) + * @param \DateTime|null $created_before Only return blog posts created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return blog posts last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return blog posts last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return blog posts last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `createdAt` (default), `name`, `updatedAt`, `createdBy`, `updatedBy`. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 20. (optional) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property property (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function createBatch($batch_input_blog_post, string $contentType = self::contentTypes['createBatch'][0]) + public function getPage($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->createBatchWithHttpInfo($batch_input_blog_post, $contentType); + list($response) = $this->getPageWithHttpInfo($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $contentType); return $response; } /** - * Operation createBatchWithHttpInfo - * - * Create a batch of Blog Posts + * Operation getPageWithHttpInfo * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation + * Get all posts + * + * @param \DateTime|null $created_at Only return blog posts created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return blog posts created after the specified time. (optional) + * @param \DateTime|null $created_before Only return blog posts created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return blog posts last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return blog posts last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return blog posts last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `createdAt` (default), `name`, `updatedAt`, `createdBy`, `updatedBy`. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 20. (optional) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createBatchWithHttpInfo($batch_input_blog_post, string $contentType = self::contentTypes['createBatch'][0]) + public function getPageWithHttpInfo($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->createBatchRequest($batch_input_blog_post, $contentType); + $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1673,53 +1900,14 @@ public function createBatchWithHttpInfo($batch_input_blog_post, string $contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { - case 201: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 207: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' === '\SplFileObject') { + case 200: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' !== 'string') { + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1737,7 +1925,7 @@ public function createBatchWithHttpInfo($batch_input_blog_post, string $contentT } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1770,7 +1958,20 @@ public function createBatchWithHttpInfo($batch_input_blog_post, string $contentT ]; } - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1800,18 +2001,10 @@ public function createBatchWithHttpInfo($batch_input_blog_post, string $contentT } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 207: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1830,19 +2023,29 @@ public function createBatchWithHttpInfo($batch_input_blog_post, string $contentT } /** - * Operation createBatchAsync - * - * Create a batch of Blog Posts + * Operation getPageAsync * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation + * Get all posts + * + * @param \DateTime|null $created_at Only return blog posts created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return blog posts created after the specified time. (optional) + * @param \DateTime|null $created_before Only return blog posts created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return blog posts last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return blog posts last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return blog posts last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `createdAt` (default), `name`, `updatedAt`, `createdBy`, `updatedBy`. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 20. (optional) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createBatchAsync($batch_input_blog_post, string $contentType = self::contentTypes['createBatch'][0]) + public function getPageAsync($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) { - return $this->createBatchAsyncWithHttpInfo($batch_input_blog_post, $contentType) + return $this->getPageAsyncWithHttpInfo($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $contentType) ->then( function ($response) { return $response[0]; @@ -1851,20 +2054,30 @@ function ($response) { } /** - * Operation createBatchAsyncWithHttpInfo - * - * Create a batch of Blog Posts + * Operation getPageAsyncWithHttpInfo * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation + * Get all posts + * + * @param \DateTime|null $created_at Only return blog posts created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return blog posts created after the specified time. (optional) + * @param \DateTime|null $created_before Only return blog posts created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return blog posts last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return blog posts last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return blog posts last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `createdAt` (default), `name`, `updatedAt`, `createdBy`, `updatedBy`. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 20. (optional) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createBatchAsyncWithHttpInfo($batch_input_blog_post, string $contentType = self::contentTypes['createBatch'][0]) + public function getPageAsyncWithHttpInfo($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; - $request = $this->createBatchRequest($batch_input_blog_post, $contentType); + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging'; + $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1903,32 +2116,145 @@ function ($exception) { } /** - * Create request for operation 'createBatch' + * Create request for operation 'getPage' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBatch'] to see the possible values for this operation + * @param \DateTime|null $created_at Only return blog posts created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return blog posts created after the specified time. (optional) + * @param \DateTime|null $created_before Only return blog posts created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return blog posts last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return blog posts last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return blog posts last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `createdAt` (default), `name`, `updatedAt`, `createdBy`, `updatedBy`. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 20. (optional) + * @param bool|null $archived Specifies whether to return deleted blog posts. Defaults to `false`. (optional) + * @param string|null $property (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createBatchRequest($batch_input_blog_post, string $contentType = self::contentTypes['createBatch'][0]) + public function getPageRequest($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) { - // verify the required parameter 'batch_input_blog_post' is set - if ($batch_input_blog_post === null || (is_array($batch_input_blog_post) && count($batch_input_blog_post) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_blog_post when calling createBatch' - ); - } - $resourcePath = '/cms/v3/blogs/posts/batch/create'; + + + + + + + + + + + $resourcePath = '/cms/v3/blogs/posts'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_at, + 'createdAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_after, + 'createdAfter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $created_before, + 'createdBefore', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_at, + 'updatedAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_after, + 'updatedAfter', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_before, + 'updatedBefore', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $property, + 'property', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); @@ -1940,14 +2266,7 @@ public function createBatchRequest($batch_input_blog_post, string $contentType = ); // for model (json/xml) - if (isset($batch_input_blog_post)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_blog_post)); - } else { - $httpBody = $batch_input_blog_post; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1990,7 +2309,7 @@ public function createBatchRequest($batch_input_blog_post, string $contentType = $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1998,38 +2317,40 @@ public function createBatchRequest($batch_input_blog_post, string $contentType = } /** - * Operation createLangVariation + * Operation getPreviousVersion * - * Create a new language variation + * Retrieve a previous version of a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function createLangVariation($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + public function getPreviousVersion($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) { - list($response) = $this->createLangVariationWithHttpInfo($blog_post_language_clone_request_v_next, $contentType); + list($response) = $this->getPreviousVersionWithHttpInfo($object_id, $revision_id, $contentType); return $response; } /** - * Operation createLangVariationWithHttpInfo + * Operation getPreviousVersionWithHttpInfo * - * Create a new language variation + * Retrieve a previous version of a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createLangVariationWithHttpInfo($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + public function getPreviousVersionWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) { - $request = $this->createLangVariationRequest($blog_post_language_clone_request_v_next, $contentType); + $request = $this->getPreviousVersionRequest($object_id, $revision_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -2053,26 +2374,14 @@ public function createLangVariationWithHttpInfo($blog_post_language_clone_reques $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== 'string') { + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -2090,7 +2399,7 @@ public function createLangVariationWithHttpInfo($blog_post_language_clone_reques } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2123,7 +2432,20 @@ public function createLangVariationWithHttpInfo($blog_post_language_clone_reques ]; } - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -2156,7 +2478,7 @@ public function createLangVariationWithHttpInfo($blog_post_language_clone_reques case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2175,19 +2497,20 @@ public function createLangVariationWithHttpInfo($blog_post_language_clone_reques } /** - * Operation createLangVariationAsync + * Operation getPreviousVersionAsync * - * Create a new language variation + * Retrieve a previous version of a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createLangVariationAsync($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + public function getPreviousVersionAsync($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) { - return $this->createLangVariationAsyncWithHttpInfo($blog_post_language_clone_request_v_next, $contentType) + return $this->getPreviousVersionAsyncWithHttpInfo($object_id, $revision_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2196,20 +2519,21 @@ function ($response) { } /** - * Operation createLangVariationAsyncWithHttpInfo + * Operation getPreviousVersionAsyncWithHttpInfo * - * Create a new language variation + * Retrieve a previous version of a blog post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createLangVariationAsyncWithHttpInfo($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + public function getPreviousVersionAsyncWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->createLangVariationRequest($blog_post_language_clone_request_v_next, $contentType); + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost'; + $request = $this->getPreviousVersionRequest($object_id, $revision_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2248,26 +2572,34 @@ function ($exception) { } /** - * Create request for operation 'createLangVariation' + * Create request for operation 'getPreviousVersion' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createLangVariationRequest($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + public function getPreviousVersionRequest($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) { - // verify the required parameter 'blog_post_language_clone_request_v_next' is set - if ($blog_post_language_clone_request_v_next === null || (is_array($blog_post_language_clone_request_v_next) && count($blog_post_language_clone_request_v_next) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling getPreviousVersion' + ); + } + + // verify the required parameter 'revision_id' is set + if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $blog_post_language_clone_request_v_next when calling createLangVariation' + 'Missing the required parameter $revision_id when calling getPreviousVersion' ); } - $resourcePath = '/cms/v3/blogs/posts/multi-language/create-language-variation'; + $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2276,6 +2608,22 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($revision_id !== null) { + $resourcePath = str_replace( + '{' . 'revisionId' . '}', + ObjectSerializer::toPathValue($revision_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -2285,14 +2633,7 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n ); // for model (json/xml) - if (isset($blog_post_language_clone_request_v_next)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($blog_post_language_clone_request_v_next)); - } else { - $httpBody = $blog_post_language_clone_request_v_next; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -2335,7 +2676,7 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2343,37 +2684,44 @@ public function createLangVariationRequest($blog_post_language_clone_request_v_n } /** - * Operation detachFromLangGroup + * Operation getPreviousVersions * - * Detach a Blog Post from a multi-language group + * Retrieves all previous versions of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve previous versions of. (required) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function detachFromLangGroup($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + public function getPreviousVersions($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) { - $this->detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_v_next, $contentType); + list($response) = $this->getPreviousVersionsWithHttpInfo($object_id, $after, $before, $limit, $contentType); + return $response; } /** - * Operation detachFromLangGroupWithHttpInfo + * Operation getPreviousVersionsWithHttpInfo * - * Detach a Blog Post from a multi-language group + * Retrieves all previous versions of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve previous versions of. (required) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) { - $request = $this->detachFromLangGroupRequest($detach_from_lang_group_request_v_next, $contentType); + $request = $this->getPreviousVersionsRequest($object_id, $after, $before, $limit, $contentType); try { $options = $this->createHttpClientOption(); @@ -2397,6 +2745,64 @@ public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_ $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -2410,10 +2816,44 @@ public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_ ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost'; + 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() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2428,19 +2868,22 @@ public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_ } /** - * Operation detachFromLangGroupAsync + * Operation getPreviousVersionsAsync * - * Detach a Blog Post from a multi-language group + * Retrieves all previous versions of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve previous versions of. (required) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function detachFromLangGroupAsync($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + public function getPreviousVersionsAsync($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) { - return $this->detachFromLangGroupAsyncWithHttpInfo($detach_from_lang_group_request_v_next, $contentType) + return $this->getPreviousVersionsAsyncWithHttpInfo($object_id, $after, $before, $limit, $contentType) ->then( function ($response) { return $response[0]; @@ -2449,26 +2892,42 @@ function ($response) { } /** - * Operation detachFromLangGroupAsyncWithHttpInfo + * Operation getPreviousVersionsAsyncWithHttpInfo * - * Detach a Blog Post from a multi-language group + * Retrieves all previous versions of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve previous versions of. (required) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function detachFromLangGroupAsyncWithHttpInfo($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + public function getPreviousVersionsAsyncWithHttpInfo($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) { - $returnType = ''; - $request = $this->detachFromLangGroupRequest($detach_from_lang_group_request_v_next, $contentType); + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost'; + $request = $this->getPreviousVersionsRequest($object_id, $after, $before, $limit, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -2488,3236 +2947,65 @@ function ($exception) { } /** - * Create request for operation 'detachFromLangGroup' + * Create request for operation 'getPreviousVersions' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to retrieve previous versions of. (required) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function detachFromLangGroupRequest($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + public function getPreviousVersionsRequest($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) { - // verify the required parameter 'detach_from_lang_group_request_v_next' is set - if ($detach_from_lang_group_request_v_next === null || (is_array($detach_from_lang_group_request_v_next) && count($detach_from_lang_group_request_v_next) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $detach_from_lang_group_request_v_next when calling detachFromLangGroup' + 'Missing the required parameter $object_id when calling getPreviousVersions' ); } - $resourcePath = '/cms/v3/blogs/posts/multi-language/detach-from-lang-group'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($detach_from_lang_group_request_v_next)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next)); - } else { - $httpBody = $detach_from_lang_group_request_v_next; - } - } elseif (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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation getById - * - * Retrieve a Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error - */ - public function getById($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) - { - list($response) = $this->getByIdWithHttpInfo($object_id, $archived, $property, $contentType); - return $response; - } - - /** - * Operation getByIdWithHttpInfo - * - * Retrieve a Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getByIdWithHttpInfo($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) - { - $request = $this->getByIdRequest($object_id, $archived, $property, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getByIdAsync - * - * Retrieve a Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsync($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) - { - return $this->getByIdAsyncWithHttpInfo($object_id, $archived, $property, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getByIdAsyncWithHttpInfo - * - * Retrieve a Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getByIdAsyncWithHttpInfo($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->getByIdRequest($object_id, $archived, $property, $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 'getById' - * - * @param string $object_id The Blog Post id. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getByIdRequest($object_id, $archived = null, $property = null, string $contentType = self::contentTypes['getById'][0]) - { - - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling getById' - ); - } - - - - - $resourcePath = '/cms/v3/blogs/posts/{objectId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $property, - 'property', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($object_id !== null) { - $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $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 - ); - } - - /** - * Operation getDraftById - * - * Retrieve the full draft version of the Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error - */ - public function getDraftById($object_id, string $contentType = self::contentTypes['getDraftById'][0]) - { - list($response) = $this->getDraftByIdWithHttpInfo($object_id, $contentType); - return $response; - } - - /** - * Operation getDraftByIdWithHttpInfo - * - * Retrieve the full draft version of the Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getDraftByIdWithHttpInfo($object_id, string $contentType = self::contentTypes['getDraftById'][0]) - { - $request = $this->getDraftByIdRequest($object_id, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDraftByIdAsync - * - * Retrieve the full draft version of the Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getDraftByIdAsync($object_id, string $contentType = self::contentTypes['getDraftById'][0]) - { - return $this->getDraftByIdAsyncWithHttpInfo($object_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDraftByIdAsyncWithHttpInfo - * - * Retrieve the full draft version of the Blog Post - * - * @param string $object_id The Blog Post id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getDraftByIdAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['getDraftById'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->getDraftByIdRequest($object_id, $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 'getDraftById' - * - * @param string $object_id The Blog Post id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftById'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getDraftByIdRequest($object_id, string $contentType = self::contentTypes['getDraftById'][0]) - { - - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling getDraftById' - ); - } - - - $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_id !== null) { - $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $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 - ); - } - - /** - * Operation getPage - * - * Get all Blog Posts - * - * @param \DateTime $created_at Only return Blog Posts created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Posts created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Posts created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Posts last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Posts last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Posts last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 20. (optional) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error - */ - public function getPage($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) - { - list($response) = $this->getPageWithHttpInfo($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $contentType); - return $response; - } - - /** - * Operation getPageWithHttpInfo - * - * Get all Blog Posts - * - * @param \DateTime $created_at Only return Blog Posts created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Posts created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Posts created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Posts last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Posts last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Posts last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 20. (optional) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPageWithHttpInfo($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) - { - $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging' !== '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\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPageAsync - * - * Get all Blog Posts - * - * @param \DateTime $created_at Only return Blog Posts created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Posts created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Posts created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Posts last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Posts last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Posts last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 20. (optional) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsync($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) - { - return $this->getPageAsyncWithHttpInfo($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPageAsyncWithHttpInfo - * - * Get all Blog Posts - * - * @param \DateTime $created_at Only return Blog Posts created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Posts created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Posts created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Posts last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Posts last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Posts last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 20. (optional) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPageAsyncWithHttpInfo($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalBlogPostForwardPaging'; - $request = $this->getPageRequest($created_at, $created_after, $created_before, $updated_at, $updated_after, $updated_before, $sort, $after, $limit, $archived, $property, $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 'getPage' - * - * @param \DateTime $created_at Only return Blog Posts created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Posts created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Posts created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Posts last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Posts last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Posts last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 20. (optional) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $property (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getPageRequest($created_at = null, $created_after = null, $created_before = null, $updated_at = null, $updated_after = null, $updated_before = null, $sort = null, $after = null, $limit = null, $archived = null, $property = null, string $contentType = self::contentTypes['getPage'][0]) - { - - - - - - - - - - - - - - $resourcePath = '/cms/v3/blogs/posts'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $created_at, - 'createdAt', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $created_after, - 'createdAfter', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $created_before, - 'createdBefore', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $updated_at, - 'updatedAt', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $updated_after, - 'updatedAfter', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $updated_before, - 'updatedBefore', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $sort, - 'sort', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $after, - 'after', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $property, - 'property', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $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 - ); - } - - /** - * Operation getPreviousVersion - * - * Retrieves a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error - */ - public function getPreviousVersion($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) - { - list($response) = $this->getPreviousVersionWithHttpInfo($object_id, $revision_id, $contentType); - return $response; - } - - /** - * Operation getPreviousVersionWithHttpInfo - * - * Retrieves a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPreviousVersionWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) - { - $request = $this->getPreviousVersionRequest($object_id, $revision_id, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\VersionBlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPreviousVersionAsync - * - * Retrieves a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPreviousVersionAsync($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) - { - return $this->getPreviousVersionAsyncWithHttpInfo($object_id, $revision_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPreviousVersionAsyncWithHttpInfo - * - * Retrieves a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPreviousVersionAsyncWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\VersionBlogPost'; - $request = $this->getPreviousVersionRequest($object_id, $revision_id, $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 'getPreviousVersion' - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getPreviousVersionRequest($object_id, $revision_id, string $contentType = self::contentTypes['getPreviousVersion'][0]) - { - - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling getPreviousVersion' - ); - } - - // verify the required parameter 'revision_id' is set - if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $revision_id when calling getPreviousVersion' - ); - } - - - $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_id !== null) { - $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - // path params - if ($revision_id !== null) { - $resourcePath = str_replace( - '{' . 'revisionId' . '}', - ObjectSerializer::toPathValue($revision_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $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 - ); - } - - /** - * Operation getPreviousVersions - * - * Retrieves all the previous versions of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error - */ - public function getPreviousVersions($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) - { - list($response) = $this->getPreviousVersionsWithHttpInfo($object_id, $after, $before, $limit, $contentType); - return $response; - } - - /** - * Operation getPreviousVersionsWithHttpInfo - * - * Retrieves all the previous versions of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) - { - $request = $this->getPreviousVersionsRequest($object_id, $after, $before, $limit, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getPreviousVersionsAsync - * - * Retrieves all the previous versions of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPreviousVersionsAsync($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) - { - return $this->getPreviousVersionsAsyncWithHttpInfo($object_id, $after, $before, $limit, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getPreviousVersionsAsyncWithHttpInfo - * - * Retrieves all the previous versions of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function getPreviousVersionsAsyncWithHttpInfo($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\CollectionResponseWithTotalVersionBlogPost'; - $request = $this->getPreviousVersionsRequest($object_id, $after, $before, $limit, $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 'getPreviousVersions' - * - * @param string $object_id The Blog Post id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function getPreviousVersionsRequest($object_id, $after = null, $before = null, $limit = null, string $contentType = self::contentTypes['getPreviousVersions'][0]) - { - - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling getPreviousVersions' - ); - } - - - - - - $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $after, - 'after', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $before, - 'before', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($object_id !== null) { - $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $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 - ); - } - - /** - * Operation pushLive - * - * Push Blog Post draft edits live - * - * @param string $object_id The id of the Blog Post for which it's draft will be pushed live. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function pushLive($object_id, string $contentType = self::contentTypes['pushLive'][0]) - { - $this->pushLiveWithHttpInfo($object_id, $contentType); - } - - /** - * Operation pushLiveWithHttpInfo - * - * Push Blog Post draft edits live - * - * @param string $object_id The id of the Blog Post for which it's draft will be pushed live. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function pushLiveWithHttpInfo($object_id, string $contentType = self::contentTypes['pushLive'][0]) - { - $request = $this->pushLiveRequest($object_id, $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(); - - 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 [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation pushLiveAsync - * - * Push Blog Post draft edits live - * - * @param string $object_id The id of the Blog Post for which it's draft will be pushed live. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function pushLiveAsync($object_id, string $contentType = self::contentTypes['pushLive'][0]) - { - return $this->pushLiveAsyncWithHttpInfo($object_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation pushLiveAsyncWithHttpInfo - * - * Push Blog Post draft edits live - * - * @param string $object_id The id of the Blog Post for which it's draft will be pushed live. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function pushLiveAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['pushLive'][0]) - { - $returnType = ''; - $request = $this->pushLiveRequest($object_id, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $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 'pushLive' - * - * @param string $object_id The id of the Blog Post for which it's draft will be pushed live. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function pushLiveRequest($object_id, string $contentType = self::contentTypes['pushLive'][0]) - { - - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling pushLive' - ); - } - - - $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft/push-live'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_id !== null) { - $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation readBatch - * - * Retrieve a batch of Blog Posts - * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error - */ - public function readBatch($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - list($response) = $this->readBatchWithHttpInfo($batch_input_string, $archived, $contentType); - return $response; - } - - /** - * Operation readBatchWithHttpInfo - * - * Retrieve a batch of Blog Posts - * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function readBatchWithHttpInfo($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - $request = $this->readBatchRequest($batch_input_string, $archived, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 207: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation readBatchAsync - * - * Retrieve a batch of Blog Posts - * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readBatchAsync($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - return $this->readBatchAsyncWithHttpInfo($batch_input_string, $archived, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation readBatchAsyncWithHttpInfo - * - * Retrieve a batch of Blog Posts - * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function readBatchAsyncWithHttpInfo($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; - $request = $this->readBatchRequest($batch_input_string, $archived, $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 'readBatch' - * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function readBatchRequest($batch_input_string, $archived = null, string $contentType = self::contentTypes['readBatch'][0]) - { - - // verify the required parameter 'batch_input_string' is set - if ($batch_input_string === null || (is_array($batch_input_string) && count($batch_input_string) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_string when calling readBatch' - ); - } - - - - $resourcePath = '/cms/v3/blogs/posts/batch/read'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($batch_input_string)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_string)); - } else { - $httpBody = $batch_input_string; - } - } elseif (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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation resetDraft - * - * Reset the Blog Post draft to the live version - * - * @param string $object_id The id of the Blog Post for which it's draft will be reset. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function resetDraft($object_id, string $contentType = self::contentTypes['resetDraft'][0]) - { - $this->resetDraftWithHttpInfo($object_id, $contentType); - } - - /** - * Operation resetDraftWithHttpInfo - * - * Reset the Blog Post draft to the live version - * - * @param string $object_id The id of the Blog Post for which it's draft will be reset. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function resetDraftWithHttpInfo($object_id, string $contentType = self::contentTypes['resetDraft'][0]) - { - $request = $this->resetDraftRequest($object_id, $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(); - - 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 [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation resetDraftAsync - * - * Reset the Blog Post draft to the live version - * - * @param string $object_id The id of the Blog Post for which it's draft will be reset. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function resetDraftAsync($object_id, string $contentType = self::contentTypes['resetDraft'][0]) - { - return $this->resetDraftAsyncWithHttpInfo($object_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation resetDraftAsyncWithHttpInfo - * - * Reset the Blog Post draft to the live version - * - * @param string $object_id The id of the Blog Post for which it's draft will be reset. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function resetDraftAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['resetDraft'][0]) - { - $returnType = ''; - $request = $this->resetDraftRequest($object_id, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $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 'resetDraft' - * - * @param string $object_id The id of the Blog Post for which it's draft will be reset. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function resetDraftRequest($object_id, string $contentType = self::contentTypes['resetDraft'][0]) - { - - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling resetDraft' - ); - } - - - $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft/reset'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($object_id !== null) { - $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation restorePreviousVersion - * - * Restore a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error - */ - public function restorePreviousVersion($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) - { - list($response) = $this->restorePreviousVersionWithHttpInfo($object_id, $revision_id, $contentType); - return $response; - } - - /** - * Operation restorePreviousVersionWithHttpInfo - * - * Restore a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function restorePreviousVersionWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) - { - $request = $this->restorePreviousVersionRequest($object_id, $revision_id, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation restorePreviousVersionAsync - * - * Restore a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function restorePreviousVersionAsync($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) - { - return $this->restorePreviousVersionAsyncWithHttpInfo($object_id, $revision_id, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation restorePreviousVersionAsyncWithHttpInfo - * - * Restore a previous version of a blog post - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function restorePreviousVersionAsyncWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) - { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->restorePreviousVersionRequest($object_id, $revision_id, $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 'restorePreviousVersion' - * - * @param string $object_id The Blog Post id. (required) - * @param string $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function restorePreviousVersionRequest($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) - { - - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling restorePreviousVersion' - ); - } - - // verify the required parameter 'revision_id' is set - if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $revision_id when calling restorePreviousVersion' - ); - } - - - $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}/restore'; + + + + $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $before, + 'before', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -5728,14 +3016,6 @@ public function restorePreviousVersionRequest($object_id, $revision_id, string $ $resourcePath ); } - // path params - if ($revision_id !== null) { - $resourcePath = str_replace( - '{' . 'revisionId' . '}', - ObjectSerializer::toPathValue($revision_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -5788,7 +3068,7 @@ public function restorePreviousVersionRequest($object_id, $revision_id, string $ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -5796,40 +3076,37 @@ public function restorePreviousVersionRequest($object_id, $revision_id, string $ } /** - * Operation restorePreviousVersionToDraft + * Operation pushLive * - * Restore a previous version of a blog post, to the draft version of the blog post + * Publish blog post draft * - * @param string $object_id The Blog Post id. (required) - * @param int $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation + * @param string $object_id The ID of the post to publish. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + * @return void */ - public function restorePreviousVersionToDraft($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) + public function pushLive($object_id, string $contentType = self::contentTypes['pushLive'][0]) { - list($response) = $this->restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_id, $contentType); - return $response; + $this->pushLiveWithHttpInfo($object_id, $contentType); } /** - * Operation restorePreviousVersionToDraftWithHttpInfo + * Operation pushLiveWithHttpInfo * - * Restore a previous version of a blog post, to the draft version of the blog post + * Publish blog post draft * - * @param string $object_id The Blog Post id. (required) - * @param int $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation + * @param string $object_id The ID of the post to publish. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) + public function pushLiveWithHttpInfo($object_id, string $contentType = self::contentTypes['pushLive'][0]) { - $request = $this->restorePreviousVersionToDraftRequest($object_id, $revision_id, $contentType); + $request = $this->pushLiveRequest($object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -5853,114 +3130,11 @@ public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_ $statusCode = $response->getStatusCode(); - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - 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 [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -5975,20 +3149,19 @@ public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_ } /** - * Operation restorePreviousVersionToDraftAsync + * Operation pushLiveAsync * - * Restore a previous version of a blog post, to the draft version of the blog post + * Publish blog post draft * - * @param string $object_id The Blog Post id. (required) - * @param int $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation + * @param string $object_id The ID of the post to publish. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function restorePreviousVersionToDraftAsync($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) + public function pushLiveAsync($object_id, string $contentType = self::contentTypes['pushLive'][0]) { - return $this->restorePreviousVersionToDraftAsyncWithHttpInfo($object_id, $revision_id, $contentType) + return $this->pushLiveAsyncWithHttpInfo($object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -5997,40 +3170,26 @@ function ($response) { } /** - * Operation restorePreviousVersionToDraftAsyncWithHttpInfo + * Operation pushLiveAsyncWithHttpInfo * - * Restore a previous version of a blog post, to the draft version of the blog post + * Publish blog post draft * - * @param string $object_id The Blog Post id. (required) - * @param int $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation + * @param string $object_id The ID of the post to publish. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function restorePreviousVersionToDraftAsyncWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) + public function pushLiveAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['pushLive'][0]) { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->restorePreviousVersionToDraftRequest($object_id, $revision_id, $contentType); + $returnType = ''; + $request = $this->pushLiveRequest($object_id, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -6050,34 +3209,26 @@ function ($exception) { } /** - * Create request for operation 'restorePreviousVersionToDraft' + * Create request for operation 'pushLive' * - * @param string $object_id The Blog Post id. (required) - * @param int $revision_id The Blog Post version id to restore. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation + * @param string $object_id The ID of the post to publish. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['pushLive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function restorePreviousVersionToDraftRequest($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) + public function pushLiveRequest($object_id, string $contentType = self::contentTypes['pushLive'][0]) { // verify the required parameter 'object_id' is set if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling restorePreviousVersionToDraft' - ); - } - - // verify the required parameter 'revision_id' is set - if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $revision_id when calling restorePreviousVersionToDraft' + 'Missing the required parameter $object_id when calling pushLive' ); } - $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}/restore-to-draft'; + $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft/push-live'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6094,18 +3245,10 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s $resourcePath ); } - // path params - if ($revision_id !== null) { - $resourcePath = str_replace( - '{' . 'revisionId' . '}', - ObjectSerializer::toPathValue($revision_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], + ['*/*', ], $contentType, $multipart ); @@ -6162,37 +3305,37 @@ public function restorePreviousVersionToDraftRequest($object_id, $revision_id, s } /** - * Operation schedule + * Operation resetDraft * - * Schedule a Blog Post to be Published + * Reset post draft to the live version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to reset. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function schedule($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) + public function resetDraft($object_id, string $contentType = self::contentTypes['resetDraft'][0]) { - $this->scheduleWithHttpInfo($content_schedule_request_v_next, $contentType); + $this->resetDraftWithHttpInfo($object_id, $contentType); } /** - * Operation scheduleWithHttpInfo + * Operation resetDraftWithHttpInfo * - * Schedule a Blog Post to be Published + * Reset post draft to the live version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to reset. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function scheduleWithHttpInfo($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) + public function resetDraftWithHttpInfo($object_id, string $contentType = self::contentTypes['resetDraft'][0]) { - $request = $this->scheduleRequest($content_schedule_request_v_next, $contentType); + $request = $this->resetDraftRequest($object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6216,18 +3359,6 @@ public function scheduleWithHttpInfo($content_schedule_request_v_next, string $c $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -6247,19 +3378,19 @@ public function scheduleWithHttpInfo($content_schedule_request_v_next, string $c } /** - * Operation scheduleAsync + * Operation resetDraftAsync * - * Schedule a Blog Post to be Published + * Reset post draft to the live version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to reset. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function scheduleAsync($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) + public function resetDraftAsync($object_id, string $contentType = self::contentTypes['resetDraft'][0]) { - return $this->scheduleAsyncWithHttpInfo($content_schedule_request_v_next, $contentType) + return $this->resetDraftAsyncWithHttpInfo($object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6268,20 +3399,20 @@ function ($response) { } /** - * Operation scheduleAsyncWithHttpInfo + * Operation resetDraftAsyncWithHttpInfo * - * Schedule a Blog Post to be Published + * Reset post draft to the live version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to reset. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function scheduleAsyncWithHttpInfo($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) + public function resetDraftAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['resetDraft'][0]) { $returnType = ''; - $request = $this->scheduleRequest($content_schedule_request_v_next, $contentType); + $request = $this->resetDraftRequest($object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6307,26 +3438,26 @@ function ($exception) { } /** - * Create request for operation 'schedule' + * Create request for operation 'resetDraft' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to reset. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function scheduleRequest($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) + public function resetDraftRequest($object_id, string $contentType = self::contentTypes['resetDraft'][0]) { - // verify the required parameter 'content_schedule_request_v_next' is set - if ($content_schedule_request_v_next === null || (is_array($content_schedule_request_v_next) && count($content_schedule_request_v_next) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $content_schedule_request_v_next when calling schedule' + 'Missing the required parameter $object_id when calling resetDraft' ); } - $resourcePath = '/cms/v3/blogs/posts/schedule'; + $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft/reset'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6335,6 +3466,14 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -6344,14 +3483,7 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten ); // for model (json/xml) - if (isset($content_schedule_request_v_next)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next)); - } else { - $httpBody = $content_schedule_request_v_next; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -6402,37 +3534,40 @@ public function scheduleRequest($content_schedule_request_v_next, string $conten } /** - * Operation setLangPrimary + * Operation restorePreviousVersion * - * Set a new primary language + * Restore a previous version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function setLangPrimary($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + public function restorePreviousVersion($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) { - $this->setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_next, $contentType); + list($response) = $this->restorePreviousVersionWithHttpInfo($object_id, $revision_id, $contentType); + return $response; } /** - * Operation setLangPrimaryWithHttpInfo + * Operation restorePreviousVersionWithHttpInfo * - * Set a new primary language + * Restore a previous version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + public function restorePreviousVersionWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) { - $request = $this->setLangPrimaryRequest($set_new_language_primary_request_v_next, $contentType); + $request = $this->restorePreviousVersionRequest($object_id, $revision_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6456,6 +3591,64 @@ public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_n $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -6469,10 +3662,44 @@ public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_n ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + 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() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -6487,19 +3714,20 @@ public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_n } /** - * Operation setLangPrimaryAsync + * Operation restorePreviousVersionAsync * - * Set a new primary language + * Restore a previous version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function setLangPrimaryAsync($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + public function restorePreviousVersionAsync($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) { - return $this->setLangPrimaryAsyncWithHttpInfo($set_new_language_primary_request_v_next, $contentType) + return $this->restorePreviousVersionAsyncWithHttpInfo($object_id, $revision_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6508,26 +3736,40 @@ function ($response) { } /** - * Operation setLangPrimaryAsyncWithHttpInfo + * Operation restorePreviousVersionAsyncWithHttpInfo * - * Set a new primary language + * Restore a previous version * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function setLangPrimaryAsyncWithHttpInfo($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + public function restorePreviousVersionAsyncWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) { - $returnType = ''; - $request = $this->setLangPrimaryRequest($set_new_language_primary_request_v_next, $contentType); + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + $request = $this->restorePreviousVersionRequest($object_id, $revision_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -6547,26 +3789,34 @@ function ($exception) { } /** - * Create request for operation 'setLangPrimary' + * Create request for operation 'restorePreviousVersion' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param string $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersion'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function setLangPrimaryRequest($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + public function restorePreviousVersionRequest($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersion'][0]) { - // verify the required parameter 'set_new_language_primary_request_v_next' is set - if ($set_new_language_primary_request_v_next === null || (is_array($set_new_language_primary_request_v_next) && count($set_new_language_primary_request_v_next) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling restorePreviousVersion' + ); + } + + // verify the required parameter 'revision_id' is set + if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $set_new_language_primary_request_v_next when calling setLangPrimary' + 'Missing the required parameter $revision_id when calling restorePreviousVersion' ); } - $resourcePath = '/cms/v3/blogs/posts/multi-language/set-new-lang-primary'; + $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}/restore'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6575,23 +3825,32 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($revision_id !== null) { + $resourcePath = str_replace( + '{' . 'revisionId' . '}', + ObjectSerializer::toPathValue($revision_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (isset($set_new_language_primary_request_v_next)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next)); - } else { - $httpBody = $set_new_language_primary_request_v_next; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -6634,7 +3893,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PUT', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -6642,42 +3901,40 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, } /** - * Operation update + * Operation restorePreviousVersionToDraft * - * Update a Blog Post + * Restore a draft to a previous version * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param int $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function update($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) + public function restorePreviousVersionToDraft($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) { - list($response) = $this->updateWithHttpInfo($object_id, $blog_post, $archived, $contentType); + list($response) = $this->restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_id, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation restorePreviousVersionToDraftWithHttpInfo * - * Update a Blog Post + * Restore a draft to a previous version * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param int $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) + public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) { - $request = $this->updateRequest($object_id, $blog_post, $archived, $contentType); + $request = $this->restorePreviousVersionToDraftRequest($object_id, $revision_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -6701,18 +3958,6 @@ public function updateWithHttpInfo($object_id, $blog_post, $archived = null, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -6771,6 +4016,19 @@ public function updateWithHttpInfo($object_id, $blog_post, $archived = null, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -6823,21 +4081,20 @@ public function updateWithHttpInfo($object_id, $blog_post, $archived = null, str } /** - * Operation updateAsync + * Operation restorePreviousVersionToDraftAsync * - * Update a Blog Post + * Restore a draft to a previous version * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param int $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) + public function restorePreviousVersionToDraftAsync($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) { - return $this->updateAsyncWithHttpInfo($object_id, $blog_post, $archived, $contentType) + return $this->restorePreviousVersionToDraftAsyncWithHttpInfo($object_id, $revision_id, $contentType) ->then( function ($response) { return $response[0]; @@ -6846,22 +4103,21 @@ function ($response) { } /** - * Operation updateAsyncWithHttpInfo + * Operation restorePreviousVersionToDraftAsyncWithHttpInfo * - * Update a Blog Post + * Restore a draft to a previous version * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param int $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) + public function restorePreviousVersionToDraftAsyncWithHttpInfo($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) { $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->updateRequest($object_id, $blog_post, $archived, $contentType); + $request = $this->restorePreviousVersionToDraftRequest($object_id, $revision_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6900,51 +4156,40 @@ function ($exception) { } /** - * Create request for operation 'update' + * Create request for operation 'restorePreviousVersionToDraft' * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The ID of the blog post. (required) + * @param int $revision_id The ID of the version to restore the blog post to. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['restorePreviousVersionToDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) + public function restorePreviousVersionToDraftRequest($object_id, $revision_id, string $contentType = self::contentTypes['restorePreviousVersionToDraft'][0]) { // verify the required parameter 'object_id' is set if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling update' + 'Missing the required parameter $object_id when calling restorePreviousVersionToDraft' ); } - // verify the required parameter 'blog_post' is set - if ($blog_post === null || (is_array($blog_post) && count($blog_post) === 0)) { + // verify the required parameter 'revision_id' is set + if ($revision_id === null || (is_array($revision_id) && count($revision_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $blog_post when calling update' + 'Missing the required parameter $revision_id when calling restorePreviousVersionToDraft' ); } - - $resourcePath = '/cms/v3/blogs/posts/{objectId}'; + $resourcePath = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}/restore-to-draft'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); // path params @@ -6955,6 +4200,14 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ $resourcePath ); } + // path params + if ($revision_id !== null) { + $resourcePath = str_replace( + '{' . 'revisionId' . '}', + ObjectSerializer::toPathValue($revision_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -6964,14 +4217,7 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ ); // for model (json/xml) - if (isset($blog_post)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($blog_post)); - } else { - $httpBody = $blog_post; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -7014,7 +4260,7 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PATCH', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7022,40 +4268,37 @@ public function updateRequest($object_id, $blog_post, $archived = null, string $ } /** - * Operation updateBatch + * Operation schedule * - * Update a batch of Blog Posts + * Schedule a post to be published * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + * @return void */ - public function updateBatch($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) + public function schedule($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) { - list($response) = $this->updateBatchWithHttpInfo($batch_input_json_node, $archived, $contentType); - return $response; + $this->scheduleWithHttpInfo($content_schedule_request_v_next, $contentType); } /** - * Operation updateBatchWithHttpInfo + * Operation scheduleWithHttpInfo * - * Update a batch of Blog Posts + * Schedule a post to be published * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) + public function scheduleWithHttpInfo($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) { - $request = $this->updateBatchRequest($batch_input_json_node, $archived, $contentType); + $request = $this->scheduleRequest($content_schedule_request_v_next, $contentType); try { $options = $this->createHttpClientOption(); @@ -7079,149 +4322,11 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null $statusCode = $response->getStatusCode(); - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 207: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; - 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 [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -7236,20 +4341,19 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null } /** - * Operation updateBatchAsync + * Operation scheduleAsync * - * Update a batch of Blog Posts + * Schedule a post to be published * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateBatchAsync($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) + public function scheduleAsync($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) { - return $this->updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived, $contentType) + return $this->scheduleAsyncWithHttpInfo($content_schedule_request_v_next, $contentType) ->then( function ($response) { return $response[0]; @@ -7258,40 +4362,26 @@ function ($response) { } /** - * Operation updateBatchAsyncWithHttpInfo + * Operation scheduleAsyncWithHttpInfo * - * Update a batch of Blog Posts + * Schedule a post to be published * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateBatchAsyncWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) + public function scheduleAsyncWithHttpInfo($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) { - $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; - $request = $this->updateBatchRequest($batch_input_json_node, $archived, $contentType); + $returnType = ''; + $request = $this->scheduleRequest($content_schedule_request_v_next, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -7311,60 +4401,49 @@ function ($exception) { } /** - * Create request for operation 'updateBatch' + * Create request for operation 'schedule' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) - * @param bool $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\ContentScheduleRequestVNext $content_schedule_request_v_next The JSON representation of the ContentScheduleRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['schedule'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateBatchRequest($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['updateBatch'][0]) + public function scheduleRequest($content_schedule_request_v_next, string $contentType = self::contentTypes['schedule'][0]) { - // verify the required parameter 'batch_input_json_node' is set - if ($batch_input_json_node === null || (is_array($batch_input_json_node) && count($batch_input_json_node) === 0)) { + // verify the required parameter 'content_schedule_request_v_next' is set + if ($content_schedule_request_v_next === null || (is_array($content_schedule_request_v_next) && count($content_schedule_request_v_next) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_json_node when calling updateBatch' + 'Missing the required parameter $content_schedule_request_v_next when calling schedule' ); } - - $resourcePath = '/cms/v3/blogs/posts/batch/update'; + $resourcePath = '/cms/v3/blogs/posts/schedule'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], + ['*/*', ], $contentType, $multipart ); // for model (json/xml) - if (isset($batch_input_json_node)) { + if (isset($content_schedule_request_v_next)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($content_schedule_request_v_next)); } else { - $httpBody = $batch_input_json_node; + $httpBody = $content_schedule_request_v_next; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -7417,40 +4496,42 @@ public function updateBatchRequest($batch_input_json_node, $archived = null, str } /** - * Operation updateDraft + * Operation update * - * Update a Blog Post draft + * Update a post * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) + * @param bool|null $archived Specifies whether to update deleted blog posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function updateDraft($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) + public function update($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateDraftWithHttpInfo($object_id, $blog_post, $contentType); + list($response) = $this->updateWithHttpInfo($object_id, $blog_post, $archived, $contentType); return $response; } /** - * Operation updateDraftWithHttpInfo + * Operation updateWithHttpInfo * - * Update a Blog Post draft + * Update a post * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) + * @param bool|null $archived Specifies whether to update deleted blog posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateDraftWithHttpInfo($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) + public function updateWithHttpInfo($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateDraftRequest($object_id, $blog_post, $contentType); + $request = $this->updateRequest($object_id, $blog_post, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -7474,18 +4555,6 @@ public function updateDraftWithHttpInfo($object_id, $blog_post, string $contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -7544,6 +4613,19 @@ public function updateDraftWithHttpInfo($object_id, $blog_post, string $contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -7596,20 +4678,21 @@ public function updateDraftWithHttpInfo($object_id, $blog_post, string $contentT } /** - * Operation updateDraftAsync + * Operation updateAsync * - * Update a Blog Post draft + * Update a post * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) + * @param bool|null $archived Specifies whether to update deleted blog posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDraftAsync($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) + public function updateAsync($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateDraftAsyncWithHttpInfo($object_id, $blog_post, $contentType) + return $this->updateAsyncWithHttpInfo($object_id, $blog_post, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -7618,21 +4701,22 @@ function ($response) { } /** - * Operation updateDraftAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * Update a Blog Post draft + * Update a post * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) + * @param bool|null $archived Specifies whether to update deleted blog posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDraftAsyncWithHttpInfo($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) + public function updateAsyncWithHttpInfo($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; - $request = $this->updateDraftRequest($object_id, $blog_post, $contentType); + $request = $this->updateRequest($object_id, $blog_post, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7671,40 +4755,51 @@ function ($exception) { } /** - * Create request for operation 'updateDraft' + * Create request for operation 'update' * - * @param string $object_id The Blog Post id. (required) - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post. (required) + * @param bool|null $archived Specifies whether to update deleted blog posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateDraftRequest($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) + public function updateRequest($object_id, $blog_post, $archived = null, string $contentType = self::contentTypes['update'][0]) { // verify the required parameter 'object_id' is set if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling updateDraft' + 'Missing the required parameter $object_id when calling update' ); } // verify the required parameter 'blog_post' is set if ($blog_post === null || (is_array($blog_post) && count($blog_post) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $blog_post when calling updateDraft' + 'Missing the required parameter $blog_post when calling update' ); } - $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft'; + + $resourcePath = '/cms/v3/blogs/posts/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -7782,37 +4877,40 @@ public function updateDraftRequest($object_id, $blog_post, string $contentType = } /** - * Operation updateLangs + * Operation updateDraft * - * Update languages of multi-language group + * Update the draft of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update the draft of. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error */ - public function updateLangs($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + public function updateDraft($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) { - $this->updateLangsWithHttpInfo($update_languages_request_v_next, $contentType); + list($response) = $this->updateDraftWithHttpInfo($object_id, $blog_post, $contentType); + return $response; } /** - * Operation updateLangsWithHttpInfo + * Operation updateDraftWithHttpInfo * - * Update languages of multi-language group + * Update the draft of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update the draft of. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateLangsWithHttpInfo($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + public function updateDraftWithHttpInfo($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) { - $request = $this->updateLangsRequest($update_languages_request_v_next, $contentType); + $request = $this->updateDraftRequest($object_id, $blog_post, $contentType); try { $options = $this->createHttpClientOption(); @@ -7836,6 +4934,64 @@ public function updateLangsWithHttpInfo($update_languages_request_v_next, string $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -7849,10 +5005,44 @@ public function updateLangsWithHttpInfo($update_languages_request_v_next, string ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + 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() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -7867,19 +5057,20 @@ public function updateLangsWithHttpInfo($update_languages_request_v_next, string } /** - * Operation updateLangsAsync + * Operation updateDraftAsync * - * Update languages of multi-language group + * Update the draft of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update the draft of. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateLangsAsync($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + public function updateDraftAsync($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) { - return $this->updateLangsAsyncWithHttpInfo($update_languages_request_v_next, $contentType) + return $this->updateDraftAsyncWithHttpInfo($object_id, $blog_post, $contentType) ->then( function ($response) { return $response[0]; @@ -7888,26 +5079,40 @@ function ($response) { } /** - * Operation updateLangsAsyncWithHttpInfo + * Operation updateDraftAsyncWithHttpInfo * - * Update languages of multi-language group + * Update the draft of a post * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update the draft of. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateLangsAsyncWithHttpInfo($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + public function updateDraftAsyncWithHttpInfo($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) { - $returnType = ''; - $request = $this->updateLangsRequest($update_languages_request_v_next, $contentType); + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + $request = $this->updateDraftRequest($object_id, $blog_post, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -7927,26 +5132,34 @@ function ($exception) { } /** - * Create request for operation 'updateLangs' + * Create request for operation 'updateDraft' * - * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * @param string $object_id The ID of the blog post to update the draft of. (required) + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost $blog_post The JSON representation of the updated Blog Post to be applied to the draft. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraft'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateLangsRequest($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + public function updateDraftRequest($object_id, $blog_post, string $contentType = self::contentTypes['updateDraft'][0]) { - // verify the required parameter 'update_languages_request_v_next' is set - if ($update_languages_request_v_next === null || (is_array($update_languages_request_v_next) && count($update_languages_request_v_next) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling updateDraft' + ); + } + + // verify the required parameter 'blog_post' is set + if ($blog_post === null || (is_array($blog_post) && count($blog_post) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $update_languages_request_v_next when calling updateLangs' + 'Missing the required parameter $blog_post when calling updateDraft' ); } - $resourcePath = '/cms/v3/blogs/posts/multi-language/update-languages'; + $resourcePath = '/cms/v3/blogs/posts/{objectId}/draft'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7955,21 +5168,29 @@ public function updateLangsRequest($update_languages_request_v_next, string $con + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (isset($update_languages_request_v_next)) { + if (isset($blog_post)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($blog_post)); } else { - $httpBody = $update_languages_request_v_next; + $httpBody = $blog_post; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -8014,7 +5235,7 @@ public function updateLangsRequest($update_languages_request_v_next, string $con $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'PATCH', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php b/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php new file mode 100644 index 000000000..051d305ce --- /dev/null +++ b/codegen/Cms/Blogs/BlogPosts/Api/BatchApi.php @@ -0,0 +1,1553 @@ + [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation archive + * + * Delete a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archive($batch_input_string, string $contentType = self::contentTypes['archive'][0]) + { + $this->archiveWithHttpInfo($batch_input_string, $contentType); + } + + /** + * Operation archiveWithHttpInfo + * + * Delete a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($batch_input_string, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($batch_input_string, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($batch_input_string, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($batch_input_string, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($batch_input_string, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($batch_input_string, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'archive' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($batch_input_string, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'batch_input_string' is set + if ($batch_input_string === null || (is_array($batch_input_string) && count($batch_input_string) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_string when calling archive' + ); + } + + + $resourcePath = '/cms/v3/blogs/posts/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_string)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_string)); + } else { + $httpBody = $batch_input_string; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + */ + public function create($batch_input_blog_post, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($batch_input_blog_post, $contentType); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($batch_input_blog_post, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($batch_input_blog_post, $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 201: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($batch_input_blog_post, string $contentType = self::contentTypes['create'][0]) + { + return $this->createAsyncWithHttpInfo($batch_input_blog_post, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create a batch of blog posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($batch_input_blog_post, string $contentType = self::contentTypes['create'][0]) + { + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; + $request = $this->createRequest($batch_input_blog_post, $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 'create' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputBlogPost $batch_input_blog_post The JSON array of new Blog Posts to create. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($batch_input_blog_post, string $contentType = self::contentTypes['create'][0]) + { + + // verify the required parameter 'batch_input_blog_post' is set + if ($batch_input_blog_post === null || (is_array($batch_input_blog_post) && count($batch_input_blog_post) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_blog_post when calling create' + ); + } + + + $resourcePath = '/cms/v3/blogs/posts/batch/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_blog_post)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_blog_post)); + } else { + $httpBody = $batch_input_blog_post; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation read + * + * Retrieve a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + */ + public function read($batch_input_string, $archived = null, string $contentType = self::contentTypes['read'][0]) + { + list($response) = $this->readWithHttpInfo($batch_input_string, $archived, $contentType); + return $response; + } + + /** + * Operation readWithHttpInfo + * + * Retrieve a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function readWithHttpInfo($batch_input_string, $archived = null, string $contentType = self::contentTypes['read'][0]) + { + $request = $this->readRequest($batch_input_string, $archived, $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: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation readAsync + * + * Retrieve a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsync($batch_input_string, $archived = null, string $contentType = self::contentTypes['read'][0]) + { + return $this->readAsyncWithHttpInfo($batch_input_string, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation readAsyncWithHttpInfo + * + * Retrieve a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsyncWithHttpInfo($batch_input_string, $archived = null, string $contentType = self::contentTypes['read'][0]) + { + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; + $request = $this->readRequest($batch_input_string, $archived, $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 'read' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputString $batch_input_string The JSON array of Blog Post ids. (required) + * @param bool|null $archived Specifies whether to return deleted blog posts Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function readRequest($batch_input_string, $archived = null, string $contentType = self::contentTypes['read'][0]) + { + + // verify the required parameter 'batch_input_string' is set + if ($batch_input_string === null || (is_array($batch_input_string) && count($batch_input_string) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_string when calling read' + ); + } + + + + $resourcePath = '/cms/v3/blogs/posts/batch/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_string)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_string)); + } else { + $httpBody = $batch_input_string; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) + * @param bool|null $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + */ + public function update($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($batch_input_json_node, $archived, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) + * @param bool|null $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($batch_input_json_node, $archived, $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: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors' !== '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\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPostWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) + * @param bool|null $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + return $this->updateAsyncWithHttpInfo($batch_input_json_node, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update a batch of Blog Posts + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) + * @param bool|null $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchResponseBlogPost'; + $request = $this->updateRequest($batch_input_json_node, $archived, $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 'update' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Posts. (required) + * @param bool|null $archived Specifies whether to update deleted Blog Posts. Defaults to `false`. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($batch_input_json_node, $archived = null, string $contentType = self::contentTypes['update'][0]) + { + + // verify the required parameter 'batch_input_json_node' is set + if ($batch_input_json_node === null || (is_array($batch_input_json_node) && count($batch_input_json_node) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_json_node when calling update' + ); + } + + + + $resourcePath = '/cms/v3/blogs/posts/batch/update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_json_node)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_json_node)); + } else { + $httpBody = $batch_input_json_node; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php b/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php new file mode 100644 index 000000000..e30809c3f --- /dev/null +++ b/codegen/Cms/Blogs/BlogPosts/Api/MultiLanguageApi.php @@ -0,0 +1,1413 @@ + [ + 'application/json', + ], + 'createLangVariation' => [ + 'application/json', + ], + 'detachFromLangGroup' => [ + 'application/json', + ], + 'setLangPrimary' => [ + 'application/json', + ], + 'updateLangs' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation attachToLangGroup + * + * Attach post to a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function attachToLangGroup($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + { + $this->attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_next, $contentType); + } + + /** + * Operation attachToLangGroupWithHttpInfo + * + * Attach post to a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + { + $request = $this->attachToLangGroupRequest($attach_to_lang_primary_request_v_next, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation attachToLangGroupAsync + * + * Attach post to a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachToLangGroupAsync($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + { + return $this->attachToLangGroupAsyncWithHttpInfo($attach_to_lang_primary_request_v_next, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation attachToLangGroupAsyncWithHttpInfo + * + * Attach post to a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachToLangGroupAsyncWithHttpInfo($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + { + $returnType = ''; + $request = $this->attachToLangGroupRequest($attach_to_lang_primary_request_v_next, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'attachToLangGroup' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\AttachToLangPrimaryRequestVNext $attach_to_lang_primary_request_v_next The JSON representation of the AttachToLangPrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachToLangGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function attachToLangGroupRequest($attach_to_lang_primary_request_v_next, string $contentType = self::contentTypes['attachToLangGroup'][0]) + { + + // verify the required parameter 'attach_to_lang_primary_request_v_next' is set + if ($attach_to_lang_primary_request_v_next === null || (is_array($attach_to_lang_primary_request_v_next) && count($attach_to_lang_primary_request_v_next) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attach_to_lang_primary_request_v_next when calling attachToLangGroup' + ); + } + + + $resourcePath = '/cms/v3/blogs/posts/multi-language/attach-to-lang-group'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($attach_to_lang_primary_request_v_next)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($attach_to_lang_primary_request_v_next)); + } else { + $httpBody = $attach_to_lang_primary_request_v_next; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createLangVariation + * + * Create a language variation + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error + */ + public function createLangVariation($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + { + list($response) = $this->createLangVariationWithHttpInfo($blog_post_language_clone_request_v_next, $contentType); + return $response; + } + + /** + * Operation createLangVariationWithHttpInfo + * + * Create a language variation + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost|\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createLangVariationWithHttpInfo($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + { + $request = $this->createLangVariationRequest($blog_post_language_clone_request_v_next, $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: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost' !== '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\Cms\Blogs\BlogPosts\Model\BlogPost', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Cms\Blogs\BlogPosts\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\Cms\Blogs\BlogPosts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createLangVariationAsync + * + * Create a language variation + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLangVariationAsync($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + { + return $this->createLangVariationAsyncWithHttpInfo($blog_post_language_clone_request_v_next, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createLangVariationAsyncWithHttpInfo + * + * Create a language variation + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLangVariationAsyncWithHttpInfo($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + { + $returnType = '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPost'; + $request = $this->createLangVariationRequest($blog_post_language_clone_request_v_next, $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 'createLangVariation' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\BlogPostLanguageCloneRequestVNext $blog_post_language_clone_request_v_next The JSON representation of the BlogPostLanguageCloneRequestVNext object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLangVariation'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createLangVariationRequest($blog_post_language_clone_request_v_next, string $contentType = self::contentTypes['createLangVariation'][0]) + { + + // verify the required parameter 'blog_post_language_clone_request_v_next' is set + if ($blog_post_language_clone_request_v_next === null || (is_array($blog_post_language_clone_request_v_next) && count($blog_post_language_clone_request_v_next) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $blog_post_language_clone_request_v_next when calling createLangVariation' + ); + } + + + $resourcePath = '/cms/v3/blogs/posts/multi-language/create-language-variation'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($blog_post_language_clone_request_v_next)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($blog_post_language_clone_request_v_next)); + } else { + $httpBody = $blog_post_language_clone_request_v_next; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation detachFromLangGroup + * + * Detach post from a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function detachFromLangGroup($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + { + $this->detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_v_next, $contentType); + } + + /** + * Operation detachFromLangGroupWithHttpInfo + * + * Detach post from a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + { + $request = $this->detachFromLangGroupRequest($detach_from_lang_group_request_v_next, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation detachFromLangGroupAsync + * + * Detach post from a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function detachFromLangGroupAsync($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + { + return $this->detachFromLangGroupAsyncWithHttpInfo($detach_from_lang_group_request_v_next, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation detachFromLangGroupAsyncWithHttpInfo + * + * Detach post from a multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function detachFromLangGroupAsyncWithHttpInfo($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + { + $returnType = ''; + $request = $this->detachFromLangGroupRequest($detach_from_lang_group_request_v_next, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'detachFromLangGroup' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\DetachFromLangGroupRequestVNext $detach_from_lang_group_request_v_next The JSON representation of the DetachFromLangGroupRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['detachFromLangGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function detachFromLangGroupRequest($detach_from_lang_group_request_v_next, string $contentType = self::contentTypes['detachFromLangGroup'][0]) + { + + // verify the required parameter 'detach_from_lang_group_request_v_next' is set + if ($detach_from_lang_group_request_v_next === null || (is_array($detach_from_lang_group_request_v_next) && count($detach_from_lang_group_request_v_next) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $detach_from_lang_group_request_v_next when calling detachFromLangGroup' + ); + } + + + $resourcePath = '/cms/v3/blogs/posts/multi-language/detach-from-lang-group'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($detach_from_lang_group_request_v_next)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($detach_from_lang_group_request_v_next)); + } else { + $httpBody = $detach_from_lang_group_request_v_next; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation setLangPrimary + * + * Set a new primary language + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function setLangPrimary($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + { + $this->setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_next, $contentType); + } + + /** + * Operation setLangPrimaryWithHttpInfo + * + * Set a new primary language + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + { + $request = $this->setLangPrimaryRequest($set_new_language_primary_request_v_next, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation setLangPrimaryAsync + * + * Set a new primary language + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function setLangPrimaryAsync($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + { + return $this->setLangPrimaryAsyncWithHttpInfo($set_new_language_primary_request_v_next, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation setLangPrimaryAsyncWithHttpInfo + * + * Set a new primary language + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function setLangPrimaryAsyncWithHttpInfo($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + { + $returnType = ''; + $request = $this->setLangPrimaryRequest($set_new_language_primary_request_v_next, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'setLangPrimary' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\SetNewLanguagePrimaryRequestVNext $set_new_language_primary_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['setLangPrimary'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function setLangPrimaryRequest($set_new_language_primary_request_v_next, string $contentType = self::contentTypes['setLangPrimary'][0]) + { + + // verify the required parameter 'set_new_language_primary_request_v_next' is set + if ($set_new_language_primary_request_v_next === null || (is_array($set_new_language_primary_request_v_next) && count($set_new_language_primary_request_v_next) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $set_new_language_primary_request_v_next when calling setLangPrimary' + ); + } + + + $resourcePath = '/cms/v3/blogs/posts/multi-language/set-new-lang-primary'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($set_new_language_primary_request_v_next)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($set_new_language_primary_request_v_next)); + } else { + $httpBody = $set_new_language_primary_request_v_next; + } + } elseif (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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateLangs + * + * Update languages of multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function updateLangs($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + { + $this->updateLangsWithHttpInfo($update_languages_request_v_next, $contentType); + } + + /** + * Operation updateLangsWithHttpInfo + * + * Update languages of multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Cms\Blogs\BlogPosts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateLangsWithHttpInfo($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + { + $request = $this->updateLangsRequest($update_languages_request_v_next, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Cms\Blogs\BlogPosts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateLangsAsync + * + * Update languages of multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLangsAsync($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + { + return $this->updateLangsAsyncWithHttpInfo($update_languages_request_v_next, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLangsAsyncWithHttpInfo + * + * Update languages of multi-language group + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLangsAsyncWithHttpInfo($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + { + $returnType = ''; + $request = $this->updateLangsRequest($update_languages_request_v_next, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateLangs' + * + * @param \HubSpot\Client\Cms\Blogs\BlogPosts\Model\UpdateLanguagesRequestVNext $update_languages_request_v_next The JSON representation of the SetNewLanguagePrimaryRequest object. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLangs'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateLangsRequest($update_languages_request_v_next, string $contentType = self::contentTypes['updateLangs'][0]) + { + + // verify the required parameter 'update_languages_request_v_next' is set + if ($update_languages_request_v_next === null || (is_array($update_languages_request_v_next) && count($update_languages_request_v_next) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_languages_request_v_next when calling updateLangs' + ); + } + + + $resourcePath = '/cms/v3/blogs/posts/multi-language/update-languages'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_languages_request_v_next)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_languages_request_v_next)); + } else { + $httpBody = $update_languages_request_v_next; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Cms/Blogs/BlogPosts/ApiException.php b/codegen/Cms/Blogs/BlogPosts/ApiException.php index f245ce356..542f1be00 100644 --- a/codegen/Cms/Blogs/BlogPosts/ApiException.php +++ b/codegen/Cms/Blogs/BlogPosts/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/Blogs/BlogPosts/Configuration.php b/codegen/Cms/Blogs/BlogPosts/Configuration.php index 5921a00c2..8b5db0d0a 100644 --- a/codegen/Cms/Blogs/BlogPosts/Configuration.php +++ b/codegen/Cms/Blogs/BlogPosts/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/Blogs/BlogPosts/HeaderSelector.php b/codegen/Cms/Blogs/BlogPosts/HeaderSelector.php index f615a4f2f..396474858 100644 --- a/codegen/Cms/Blogs/BlogPosts/HeaderSelector.php +++ b/codegen/Cms/Blogs/BlogPosts/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/Blogs/BlogPosts/Model/Angle.php b/codegen/Cms/Blogs/BlogPosts/Model/Angle.php index cf7b8670c..242cb7215 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/Angle.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/Angle.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('units', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/AttachToLangPrimaryRequestVNext.php b/codegen/Cms/Blogs/BlogPosts/Model/AttachToLangPrimaryRequestVNext.php index 202e3fda2..e9abfa701 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/AttachToLangPrimaryRequestVNext.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/AttachToLangPrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -1781,10 +1781,10 @@ public function getLanguageAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('language', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BackgroundImage.php b/codegen/Cms/Blogs/BlogPosts/Model/BackgroundImage.php index f596f9978..9db2c0e9b 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BackgroundImage.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BackgroundImage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('image_url', $data ?? [], null); $this->setIfExists('background_size', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BatchInputBlogPost.php b/codegen/Cms/Blogs/BlogPosts/Model/BatchInputBlogPost.php index 2799eb2eb..edf095eed 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BatchInputBlogPost.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BatchInputBlogPost.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BatchInputJsonNode.php b/codegen/Cms/Blogs/BlogPosts/Model/BatchInputJsonNode.php index 5150d3e28..dd90ef651 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BatchInputJsonNode.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BatchInputJsonNode.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BatchInputString.php b/codegen/Cms/Blogs/BlogPosts/Model/BatchInputString.php index bbefe0225..dad13a8a9 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BatchInputString.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BatchInputString.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPost.php b/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPost.php index a25b97442..e1ce1289f 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPost.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPost.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -289,10 +289,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPostWithErrors.php b/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPostWithErrors.php index 13a2e1d3f..61a416705 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPostWithErrors.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BatchResponseBlogPostWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -301,10 +301,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BlogPost.php b/codegen/Cms/Blogs/BlogPosts/Model/BlogPost.php index 61ab91bfa..5990985f9 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BlogPost.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BlogPost.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -2266,10 +2266,10 @@ public function getCurrentStateAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('publish_date', $data ?? [], null); $this->setIfExists('language', $data ?? [], null); @@ -2639,7 +2639,7 @@ public function getLanguage() /** * Sets language * - * @param string $language The explicitly defined ISO 639 language code of the Blog Post. If null, the Blog Post will default to the language of the ParentBlog. + * @param string $language The explicitly defined ISO 639 language code of the post. If null, the post will default to the language of the parent blog. * * @return self */ @@ -2784,7 +2784,7 @@ public function getHtmlTitle() /** * Sets html_title * - * @param string $html_title The html title of this Blog Post. + * @param string $html_title The HTML title of the post. * * @return self */ @@ -2865,7 +2865,7 @@ public function getId() /** * Sets id * - * @param string $id The unique ID of the Blog Post. + * @param string $id The unique ID of the blog post. * * @return self */ @@ -2892,7 +2892,7 @@ public function getState() /** * Sets state * - * @param string $state An ENUM descibing the current state of this Blog Post. + * @param string $state An enumeration describing the current publish state of the post. * * @return self */ @@ -2923,7 +2923,7 @@ public function getSlug() /** * Sets slug * - * @param string $slug The path of the this blog post. This field is appended to the domain to construct the url of this post. + * @param string $slug The URL slug of the blog post. This field is appended to the domain to construct the url of this post. * * @return self */ @@ -2950,7 +2950,7 @@ public function getCreatedById() /** * Sets created_by_id * - * @param string $created_by_id The ID of the user that created this Blog Post. + * @param string $created_by_id The ID of the user that created the post. * * @return self */ @@ -3149,7 +3149,7 @@ public function getUpdatedById() /** * Sets updated_by_id * - * @param string $updated_by_id The ID of the user that updated this Blog Post. + * @param string $updated_by_id The ID of the user that updated the post. * * @return self */ @@ -3176,7 +3176,7 @@ public function getTranslatedFromId() /** * Sets translated_from_id * - * @param string $translated_from_id ID of the primary blog post this object was translated from. + * @param string $translated_from_id ID of the primary blog post that this post was translated from. * * @return self */ @@ -3338,7 +3338,7 @@ public function getAuthorName() /** * Sets author_name * - * @param string $author_name The name of the user that updated this Blog Post. + * @param string $author_name The name of the blog author associated with the post. * * @return self */ @@ -3365,7 +3365,7 @@ public function getDomain() /** * Sets domain * - * @param string $domain The domain this Blog Post will resolve to. If null, the Blog Post will default to the domain of the ParentBlog. + * @param string $domain The domain that the post lives on. If null, the post will default to the domain of the parent blog. * * @return self */ @@ -3392,7 +3392,7 @@ public function getName() /** * Sets name * - * @param string $name The internal name of the Blog Post. + * @param string $name The internal name of the post. * * @return self */ @@ -3419,7 +3419,7 @@ public function getDynamicPageHubDbTableId() /** * Sets dynamic_page_hub_db_table_id * - * @param string $dynamic_page_hub_db_table_id The ID of the HubDB table this Blog Post references, if applicable + * @param string $dynamic_page_hub_db_table_id For dynamic HubDB pages, the ID of the HubDB table this post references. * * @return self */ @@ -3446,7 +3446,7 @@ public function getCampaign() /** * Sets campaign * - * @param string $campaign The GUID of the marketing campaign this Blog Post is a part of. + * @param string $campaign The GUID of the marketing campaign the post is associated with. * * @return self */ @@ -3635,7 +3635,7 @@ public function getTagIds() /** * Sets tag_ids * - * @param int[] $tag_ids List of IDs for the tags associated with this Blog Post. + * @param int[] $tag_ids The IDs of the tags associated with this post. * * @return self */ @@ -3807,7 +3807,7 @@ public function getUseFeaturedImage() /** * Sets use_featured_image * - * @param bool $use_featured_image Boolean to determine if this post should use a featuredImage. + * @param bool $use_featured_image Boolean to determine if this post should use a featured image. * * @return self */ @@ -3888,7 +3888,7 @@ public function getBlogAuthorId() /** * Sets blog_author_id * - * @param string $blog_author_id The ID of the Blog Author associated with this Blog Post. + * @param string $blog_author_id The ID of the blog author associated with this post. * * @return self */ @@ -3915,7 +3915,7 @@ public function getContentGroupId() /** * Sets content_group_id * - * @param string $content_group_id The ID of the parent Blog this Blog Post is associated with. + * @param string $content_group_id The ID of the post's parent blog. * * @return self */ @@ -4249,7 +4249,7 @@ public function getCategoryId() /** * Sets category_id * - * @param int $category_id ID of the type of object this is. + * @param int $category_id ID of the object type. * * @return self */ diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BlogPostLanguageCloneRequestVNext.php b/codegen/Cms/Blogs/BlogPosts/Model/BlogPostLanguageCloneRequestVNext.php index d06ced919..ebd154227 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BlogPostLanguageCloneRequestVNext.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BlogPostLanguageCloneRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('language', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/BreakpointStyles.php b/codegen/Cms/Blogs/BlogPosts/Model/BreakpointStyles.php index 3612a3e0f..61342fea2 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/BreakpointStyles.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/BreakpointStyles.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('padding', $data ?? [], null); $this->setIfExists('margin', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalBlogPostForwardPaging.php b/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalBlogPostForwardPaging.php index 25ef37930..023c82c7d 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalBlogPostForwardPaging.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalBlogPostForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php b/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php index febcee5bb..20cb69a49 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/CollectionResponseWithTotalVersionBlogPost.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/ColorStop.php b/codegen/Cms/Blogs/BlogPosts/Model/ColorStop.php index 59b77fd39..ace9583c6 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/ColorStop.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/ColorStop.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('color', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/BlogPosts/Model/ContentCloneRequestVNext.php b/codegen/Cms/Blogs/BlogPosts/Model/ContentCloneRequestVNext.php index 058862d10..e3a2428b0 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/ContentCloneRequestVNext.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/ContentCloneRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('clone_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/ContentLanguageVariation.php b/codegen/Cms/Blogs/BlogPosts/Model/ContentLanguageVariation.php index c23935c8f..92c8d1ac2 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/ContentLanguageVariation.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/ContentLanguageVariation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -323,10 +323,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('archived_in_dashboard', $data ?? [], null); $this->setIfExists('created', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/ContentScheduleRequestVNext.php b/codegen/Cms/Blogs/BlogPosts/Model/ContentScheduleRequestVNext.php index 163f1344d..ebfcfe6f7 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/ContentScheduleRequestVNext.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/ContentScheduleRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('publish_date', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/DetachFromLangGroupRequestVNext.php b/codegen/Cms/Blogs/BlogPosts/Model/DetachFromLangGroupRequestVNext.php index 7f04b03e2..2c9d3c9a7 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/DetachFromLangGroupRequestVNext.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/DetachFromLangGroupRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/BlogPosts/Model/Error.php b/codegen/Cms/Blogs/BlogPosts/Model/Error.php index 2e97ef82c..f085753ee 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/Error.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/ErrorDetail.php b/codegen/Cms/Blogs/BlogPosts/Model/ErrorDetail.php index 1f5118fa4..20640f4e0 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/ErrorDetail.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/ForwardPaging.php b/codegen/Cms/Blogs/BlogPosts/Model/ForwardPaging.php index 95350cc57..0ca2d6808 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/ForwardPaging.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/BlogPosts/Model/Gradient.php b/codegen/Cms/Blogs/BlogPosts/Model/Gradient.php index 48cb6aaad..4b99d9423 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/Gradient.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/Gradient.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('angle', $data ?? [], null); $this->setIfExists('side_or_corner', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/LayoutSection.php b/codegen/Cms/Blogs/BlogPosts/Model/LayoutSection.php index 309727a88..61464f9c9 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/LayoutSection.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/LayoutSection.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -311,10 +311,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('css_style', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/ModelInterface.php b/codegen/Cms/Blogs/BlogPosts/Model/ModelInterface.php index 76755fe14..80f8951e3 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/ModelInterface.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/Blogs/BlogPosts/Model/NextPage.php b/codegen/Cms/Blogs/BlogPosts/Model/NextPage.php index d28692ee0..7017223f5 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/NextPage.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/Paging.php b/codegen/Cms/Blogs/BlogPosts/Model/Paging.php index c08b62038..5064409d5 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/Paging.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/PreviousPage.php b/codegen/Cms/Blogs/BlogPosts/Model/PreviousPage.php index 5bb4e82ba..5f200fde4 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/PreviousPage.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/RGBAColor.php b/codegen/Cms/Blogs/BlogPosts/Model/RGBAColor.php index a62c873f0..d62fc7577 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/RGBAColor.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/RGBAColor.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('a', $data ?? [], null); $this->setIfExists('r', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/RowMetaData.php b/codegen/Cms/Blogs/BlogPosts/Model/RowMetaData.php index 0f1d883c0..bd04700d8 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/RowMetaData.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/RowMetaData.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('css_class', $data ?? [], null); $this->setIfExists('styles', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/SetNewLanguagePrimaryRequestVNext.php b/codegen/Cms/Blogs/BlogPosts/Model/SetNewLanguagePrimaryRequestVNext.php index eca67a79c..2eda417db 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/SetNewLanguagePrimaryRequestVNext.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/SetNewLanguagePrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/BlogPosts/Model/SideOrCorner.php b/codegen/Cms/Blogs/BlogPosts/Model/SideOrCorner.php index 34e0ad45d..ffdc25f2c 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/SideOrCorner.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/SideOrCorner.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('horizontal_side', $data ?? [], null); $this->setIfExists('vertical_side', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/StandardError.php b/codegen/Cms/Blogs/BlogPosts/Model/StandardError.php index a53206ffd..5e1eff513 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/StandardError.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/Styles.php b/codegen/Cms/Blogs/BlogPosts/Model/Styles.php index 929504e35..d766079e8 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/Styles.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/Styles.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('background_color', $data ?? [], null); $this->setIfExists('flexbox_positioning', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/UpdateLanguagesRequestVNext.php b/codegen/Cms/Blogs/BlogPosts/Model/UpdateLanguagesRequestVNext.php index d6e15b250..b835fd301 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/UpdateLanguagesRequestVNext.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/UpdateLanguagesRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('languages', $data ?? [], null); $this->setIfExists('primary_id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/VersionBlogPost.php b/codegen/Cms/Blogs/BlogPosts/Model/VersionBlogPost.php index 7b1e49304..4a0f8061a 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/VersionBlogPost.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/VersionBlogPost.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('user', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/Model/VersionUser.php b/codegen/Cms/Blogs/BlogPosts/Model/VersionUser.php index 37b4d8a81..619f88f53 100644 --- a/codegen/Cms/Blogs/BlogPosts/Model/VersionUser.php +++ b/codegen/Cms/Blogs/BlogPosts/Model/VersionUser.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('full_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/BlogPosts/ObjectSerializer.php b/codegen/Cms/Blogs/BlogPosts/ObjectSerializer.php index 381ac4f4d..3184195a8 100644 --- a/codegen/Cms/Blogs/BlogPosts/ObjectSerializer.php +++ b/codegen/Cms/Blogs/BlogPosts/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php b/codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php index 2c4608e8b..e6600920a 100644 --- a/codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php +++ b/codegen/Cms/Blogs/Tags/Api/BlogTagsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -122,13 +122,13 @@ class BlogTagsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -167,7 +167,7 @@ public function getConfig() * Delete a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -185,7 +185,7 @@ public function archive($object_id, $archived = null, string $contentType = self * Delete a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -218,18 +218,6 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -254,7 +242,7 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten * Delete a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -276,7 +264,7 @@ function ($response) { * Delete a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -314,7 +302,7 @@ function ($exception) { * Create request for operation 'archive' * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -472,18 +460,6 @@ public function archiveBatchWithHttpInfo($batch_input_string, string $contentTyp $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -712,18 +688,6 @@ public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -953,18 +917,6 @@ public function createWithHttpInfo($tag, string $contentType = self::contentType $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -1023,6 +975,19 @@ public function createWithHttpInfo($tag, string $contentType = self::contentType ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1298,18 +1263,6 @@ public function createBatchWithHttpInfo($batch_input_tag, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -1395,6 +1348,19 @@ public function createBatchWithHttpInfo($batch_input_tag, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1678,18 +1644,6 @@ public function createLangVariationWithHttpInfo($tag_clone_request_v_next, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1748,6 +1702,19 @@ public function createLangVariationWithHttpInfo($tag_clone_request_v_next, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2022,18 +1989,6 @@ public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -2213,8 +2168,8 @@ public function detachFromLangGroupRequest($detach_from_lang_group_request_v_nex * Retrieve a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -2233,8 +2188,8 @@ public function getById($object_id, $archived = null, $property = null, string $ * Retrieve a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -2267,18 +2222,6 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2337,6 +2280,19 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2394,8 +2350,8 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu * Retrieve a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2417,8 +2373,8 @@ function ($response) { * Retrieve a Blog Tag * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2469,8 +2425,8 @@ function ($exception) { * Create request for operation 'getById' * * @param string $object_id The Blog Tag id. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2588,17 +2544,17 @@ public function getByIdRequest($object_id, $archived = null, $property = null, s * * Get all Blog Tags * - * @param \DateTime $created_at Only return Blog Tags created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Tags created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Tags created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Tags last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Tags last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param \DateTime|null $created_at Only return Blog Tags created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Tags created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Tags created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Tags last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Tags last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -2616,17 +2572,17 @@ public function getPage($created_at = null, $created_after = null, $created_befo * * Get all Blog Tags * - * @param \DateTime $created_at Only return Blog Tags created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Tags created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Tags created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Tags last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Tags last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Tags created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Tags created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Tags created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Tags last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Tags last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -2659,18 +2615,6 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2729,6 +2673,19 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\CollectionResponseWithTotalTagForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2785,17 +2742,17 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ * * Get all Blog Tags * - * @param \DateTime $created_at Only return Blog Tags created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Tags created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Tags created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Tags last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Tags last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Tags created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Tags created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Tags created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Tags last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Tags last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2816,17 +2773,17 @@ function ($response) { * * Get all Blog Tags * - * @param \DateTime $created_at Only return Blog Tags created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Tags created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Tags created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Tags last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Tags last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Tags created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Tags created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Tags created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Tags last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Tags last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2876,17 +2833,17 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param \DateTime $created_at Only return Blog Tags created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Blog Tags created after the specified time. (optional) - * @param \DateTime $created_before Only return Blog Tags created before the specified time. (optional) - * @param \DateTime $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Blog Tags last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Blog Tags last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Blog Tags created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Blog Tags created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Blog Tags created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Blog Tags last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Blog Tags last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Blog Tags last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3080,7 +3037,7 @@ public function getPageRequest($created_at = null, $created_after = null, $creat * Retrieve a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -3099,7 +3056,7 @@ public function readBatch($batch_input_string, $archived = null, string $content * Retrieve a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -3132,18 +3089,6 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3229,6 +3174,19 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3294,7 +3252,7 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str * Retrieve a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3316,7 +3274,7 @@ function ($response) { * Retrieve a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3367,7 +3325,7 @@ function ($exception) { * Create request for operation 'readBatch' * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputString $batch_input_string The JSON array of Blog Tag ids. (required) - * @param bool $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3524,18 +3482,6 @@ public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_n $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -3716,7 +3662,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, * * @param string $object_id The Blog Tag id. (required) * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of the updated Blog Tag. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -3736,7 +3682,7 @@ public function update($object_id, $tag, $archived = null, string $contentType = * * @param string $object_id The Blog Tag id. (required) * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of the updated Blog Tag. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -3769,18 +3715,6 @@ public function updateWithHttpInfo($object_id, $tag, $archived = null, string $c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3839,6 +3773,19 @@ public function updateWithHttpInfo($object_id, $tag, $archived = null, string $c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\Tag'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3897,7 +3844,7 @@ public function updateWithHttpInfo($object_id, $tag, $archived = null, string $c * * @param string $object_id The Blog Tag id. (required) * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of the updated Blog Tag. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3920,7 +3867,7 @@ function ($response) { * * @param string $object_id The Blog Tag id. (required) * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of the updated Blog Tag. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3972,7 +3919,7 @@ function ($exception) { * * @param string $object_id The Blog Tag id. (required) * @param \HubSpot\Client\Cms\Blogs\Tags\Model\Tag $tag The JSON representation of the updated Blog Tag. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4095,7 +4042,7 @@ public function updateRequest($object_id, $tag, $archived = null, string $conten * Update a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Tags. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -4114,7 +4061,7 @@ public function updateBatch($batch_input_json_node, $archived = null, string $co * Update a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Tags. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Blogs\Tags\ApiException on non-2xx response or if the response body is not in the expected format @@ -4147,18 +4094,6 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4244,6 +4179,19 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Blogs\Tags\Model\BatchResponseTag'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4309,7 +4257,7 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null * Update a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Tags. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4331,7 +4279,7 @@ function ($response) { * Update a batch of Blog Tags * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Tags. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4382,7 +4330,7 @@ function ($exception) { * Create request for operation 'updateBatch' * * @param \HubSpot\Client\Cms\Blogs\Tags\Model\BatchInputJsonNode $batch_input_json_node A JSON array of the JSON representations of the updated Blog Tags. (required) - * @param bool $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Blog Tags. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4539,18 +4487,6 @@ public function updateLangsWithHttpInfo($update_languages_request_v_next, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; diff --git a/codegen/Cms/Blogs/Tags/ApiException.php b/codegen/Cms/Blogs/Tags/ApiException.php index 634c04c74..0213c579b 100644 --- a/codegen/Cms/Blogs/Tags/ApiException.php +++ b/codegen/Cms/Blogs/Tags/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/Blogs/Tags/Configuration.php b/codegen/Cms/Blogs/Tags/Configuration.php index b35409b30..cecd52ab9 100644 --- a/codegen/Cms/Blogs/Tags/Configuration.php +++ b/codegen/Cms/Blogs/Tags/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/Blogs/Tags/HeaderSelector.php b/codegen/Cms/Blogs/Tags/HeaderSelector.php index 82960b742..f68d99656 100644 --- a/codegen/Cms/Blogs/Tags/HeaderSelector.php +++ b/codegen/Cms/Blogs/Tags/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/Blogs/Tags/Model/AttachToLangPrimaryRequestVNext.php b/codegen/Cms/Blogs/Tags/Model/AttachToLangPrimaryRequestVNext.php index 3b5286ac7..58f4a51b4 100644 --- a/codegen/Cms/Blogs/Tags/Model/AttachToLangPrimaryRequestVNext.php +++ b/codegen/Cms/Blogs/Tags/Model/AttachToLangPrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('language', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/BatchInputJsonNode.php b/codegen/Cms/Blogs/Tags/Model/BatchInputJsonNode.php index 7e59e16fc..0c6630f32 100644 --- a/codegen/Cms/Blogs/Tags/Model/BatchInputJsonNode.php +++ b/codegen/Cms/Blogs/Tags/Model/BatchInputJsonNode.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Tags/Model/BatchInputString.php b/codegen/Cms/Blogs/Tags/Model/BatchInputString.php index ae472bcc5..4c181bf67 100644 --- a/codegen/Cms/Blogs/Tags/Model/BatchInputString.php +++ b/codegen/Cms/Blogs/Tags/Model/BatchInputString.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Tags/Model/BatchInputTag.php b/codegen/Cms/Blogs/Tags/Model/BatchInputTag.php index dd80d03c4..110f883ef 100644 --- a/codegen/Cms/Blogs/Tags/Model/BatchInputTag.php +++ b/codegen/Cms/Blogs/Tags/Model/BatchInputTag.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Tags/Model/BatchResponseTag.php b/codegen/Cms/Blogs/Tags/Model/BatchResponseTag.php index df246f4f9..52b6579d3 100644 --- a/codegen/Cms/Blogs/Tags/Model/BatchResponseTag.php +++ b/codegen/Cms/Blogs/Tags/Model/BatchResponseTag.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -289,10 +289,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/BatchResponseTagWithErrors.php b/codegen/Cms/Blogs/Tags/Model/BatchResponseTagWithErrors.php index 943170d88..69c8df3da 100644 --- a/codegen/Cms/Blogs/Tags/Model/BatchResponseTagWithErrors.php +++ b/codegen/Cms/Blogs/Tags/Model/BatchResponseTagWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -301,10 +301,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/CollectionResponseWithTotalTagForwardPaging.php b/codegen/Cms/Blogs/Tags/Model/CollectionResponseWithTotalTagForwardPaging.php index e67ed75f7..d46ea5562 100644 --- a/codegen/Cms/Blogs/Tags/Model/CollectionResponseWithTotalTagForwardPaging.php +++ b/codegen/Cms/Blogs/Tags/Model/CollectionResponseWithTotalTagForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/DetachFromLangGroupRequestVNext.php b/codegen/Cms/Blogs/Tags/Model/DetachFromLangGroupRequestVNext.php index 752456162..1be5b1e85 100644 --- a/codegen/Cms/Blogs/Tags/Model/DetachFromLangGroupRequestVNext.php +++ b/codegen/Cms/Blogs/Tags/Model/DetachFromLangGroupRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Tags/Model/Error.php b/codegen/Cms/Blogs/Tags/Model/Error.php index c284a26d4..fc110c3ff 100644 --- a/codegen/Cms/Blogs/Tags/Model/Error.php +++ b/codegen/Cms/Blogs/Tags/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/ErrorDetail.php b/codegen/Cms/Blogs/Tags/Model/ErrorDetail.php index 3fbbe65d9..b0db5bc82 100644 --- a/codegen/Cms/Blogs/Tags/Model/ErrorDetail.php +++ b/codegen/Cms/Blogs/Tags/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/ForwardPaging.php b/codegen/Cms/Blogs/Tags/Model/ForwardPaging.php index c250de4f6..fd21d92a6 100644 --- a/codegen/Cms/Blogs/Tags/Model/ForwardPaging.php +++ b/codegen/Cms/Blogs/Tags/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Tags/Model/ModelInterface.php b/codegen/Cms/Blogs/Tags/Model/ModelInterface.php index 50069135f..196e9f1c9 100644 --- a/codegen/Cms/Blogs/Tags/Model/ModelInterface.php +++ b/codegen/Cms/Blogs/Tags/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/Blogs/Tags/Model/NextPage.php b/codegen/Cms/Blogs/Tags/Model/NextPage.php index 033234070..f7f5fce90 100644 --- a/codegen/Cms/Blogs/Tags/Model/NextPage.php +++ b/codegen/Cms/Blogs/Tags/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/SetNewLanguagePrimaryRequestVNext.php b/codegen/Cms/Blogs/Tags/Model/SetNewLanguagePrimaryRequestVNext.php index c991f88e7..f33850009 100644 --- a/codegen/Cms/Blogs/Tags/Model/SetNewLanguagePrimaryRequestVNext.php +++ b/codegen/Cms/Blogs/Tags/Model/SetNewLanguagePrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Blogs/Tags/Model/StandardError.php b/codegen/Cms/Blogs/Tags/Model/StandardError.php index bb6e57c11..6cbbd8808 100644 --- a/codegen/Cms/Blogs/Tags/Model/StandardError.php +++ b/codegen/Cms/Blogs/Tags/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/Tag.php b/codegen/Cms/Blogs/Tags/Model/Tag.php index c10d75ddd..04bb08bb2 100644 --- a/codegen/Cms/Blogs/Tags/Model/Tag.php +++ b/codegen/Cms/Blogs/Tags/Model/Tag.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -1795,10 +1795,10 @@ public function getLanguageAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('deleted_at', $data ?? [], null); $this->setIfExists('created', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/TagCloneRequestVNext.php b/codegen/Cms/Blogs/Tags/Model/TagCloneRequestVNext.php index a5f76a812..8d7f7e7f5 100644 --- a/codegen/Cms/Blogs/Tags/Model/TagCloneRequestVNext.php +++ b/codegen/Cms/Blogs/Tags/Model/TagCloneRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('language', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/Model/UpdateLanguagesRequestVNext.php b/codegen/Cms/Blogs/Tags/Model/UpdateLanguagesRequestVNext.php index 2c633be7d..4ee27068d 100644 --- a/codegen/Cms/Blogs/Tags/Model/UpdateLanguagesRequestVNext.php +++ b/codegen/Cms/Blogs/Tags/Model/UpdateLanguagesRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('languages', $data ?? [], null); $this->setIfExists('primary_id', $data ?? [], null); diff --git a/codegen/Cms/Blogs/Tags/ObjectSerializer.php b/codegen/Cms/Blogs/Tags/ObjectSerializer.php index 3f4c456d7..df6b06f9a 100644 --- a/codegen/Cms/Blogs/Tags/ObjectSerializer.php +++ b/codegen/Cms/Blogs/Tags/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/Domains/Api/DomainsApi.php b/codegen/Cms/Domains/Api/DomainsApi.php index 108a66bd5..bd69e1e1d 100644 --- a/codegen/Cms/Domains/Api/DomainsApi.php +++ b/codegen/Cms/Domains/Api/DomainsApi.php @@ -10,13 +10,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class DomainsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -181,18 +181,6 @@ public function getByIdWithHttpInfo($domain_id, string $contentType = self::cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -251,6 +239,19 @@ public function getByIdWithHttpInfo($domain_id, string $contentType = self::cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Domains\Model\Domain'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -476,16 +477,16 @@ public function getByIdRequest($domain_id, string $contentType = self::contentTy * * Get current domains * - * @param \DateTime $created_at Only return domains created at this date. (optional) - * @param \DateTime $created_after Only return domains created after this date. (optional) - * @param \DateTime $created_before Only return domains created before this date. (optional) - * @param \DateTime $updated_at Only return domains updated at this date. (optional) - * @param \DateTime $updated_after Only return domains updated after this date. (optional) - * @param \DateTime $updated_before Only return domains updated before this date. (optional) - * @param string[] $sort sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of results per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return domains created at this date. (optional) + * @param \DateTime|null $created_after Only return domains created after this date. (optional) + * @param \DateTime|null $created_before Only return domains created before this date. (optional) + * @param \DateTime|null $updated_at Only return domains updated at this date. (optional) + * @param \DateTime|null $updated_after Only return domains updated after this date. (optional) + * @param \DateTime|null $updated_before Only return domains updated before this date. (optional) + * @param string[]|null $sort sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of results per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Domains\ApiException on non-2xx response or if the response body is not in the expected format @@ -503,16 +504,16 @@ public function getPage($created_at = null, $created_after = null, $created_befo * * Get current domains * - * @param \DateTime $created_at Only return domains created at this date. (optional) - * @param \DateTime $created_after Only return domains created after this date. (optional) - * @param \DateTime $created_before Only return domains created before this date. (optional) - * @param \DateTime $updated_at Only return domains updated at this date. (optional) - * @param \DateTime $updated_after Only return domains updated after this date. (optional) - * @param \DateTime $updated_before Only return domains updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of results per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return domains created at this date. (optional) + * @param \DateTime|null $created_after Only return domains created after this date. (optional) + * @param \DateTime|null $created_before Only return domains created before this date. (optional) + * @param \DateTime|null $updated_at Only return domains updated at this date. (optional) + * @param \DateTime|null $updated_after Only return domains updated after this date. (optional) + * @param \DateTime|null $updated_before Only return domains updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of results per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Domains\ApiException on non-2xx response or if the response body is not in the expected format @@ -545,18 +546,6 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -615,6 +604,19 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Domains\Model\CollectionResponseWithTotalDomainForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -671,16 +673,16 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ * * Get current domains * - * @param \DateTime $created_at Only return domains created at this date. (optional) - * @param \DateTime $created_after Only return domains created after this date. (optional) - * @param \DateTime $created_before Only return domains created before this date. (optional) - * @param \DateTime $updated_at Only return domains updated at this date. (optional) - * @param \DateTime $updated_after Only return domains updated after this date. (optional) - * @param \DateTime $updated_before Only return domains updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of results per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return domains created at this date. (optional) + * @param \DateTime|null $created_after Only return domains created after this date. (optional) + * @param \DateTime|null $created_before Only return domains created before this date. (optional) + * @param \DateTime|null $updated_at Only return domains updated at this date. (optional) + * @param \DateTime|null $updated_after Only return domains updated after this date. (optional) + * @param \DateTime|null $updated_before Only return domains updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of results per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -701,16 +703,16 @@ function ($response) { * * Get current domains * - * @param \DateTime $created_at Only return domains created at this date. (optional) - * @param \DateTime $created_after Only return domains created after this date. (optional) - * @param \DateTime $created_before Only return domains created before this date. (optional) - * @param \DateTime $updated_at Only return domains updated at this date. (optional) - * @param \DateTime $updated_after Only return domains updated after this date. (optional) - * @param \DateTime $updated_before Only return domains updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of results per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return domains created at this date. (optional) + * @param \DateTime|null $created_after Only return domains created after this date. (optional) + * @param \DateTime|null $created_before Only return domains created before this date. (optional) + * @param \DateTime|null $updated_at Only return domains updated at this date. (optional) + * @param \DateTime|null $updated_after Only return domains updated after this date. (optional) + * @param \DateTime|null $updated_before Only return domains updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of results per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -760,16 +762,16 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param \DateTime $created_at Only return domains created at this date. (optional) - * @param \DateTime $created_after Only return domains created after this date. (optional) - * @param \DateTime $created_before Only return domains created before this date. (optional) - * @param \DateTime $updated_at Only return domains updated at this date. (optional) - * @param \DateTime $updated_after Only return domains updated after this date. (optional) - * @param \DateTime $updated_before Only return domains updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of results per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return domains created at this date. (optional) + * @param \DateTime|null $created_after Only return domains created after this date. (optional) + * @param \DateTime|null $created_before Only return domains created before this date. (optional) + * @param \DateTime|null $updated_at Only return domains updated at this date. (optional) + * @param \DateTime|null $updated_after Only return domains updated after this date. (optional) + * @param \DateTime|null $updated_before Only return domains updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of results per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Cms/Domains/ApiException.php b/codegen/Cms/Domains/ApiException.php index 0bbe3acb5..904608952 100644 --- a/codegen/Cms/Domains/ApiException.php +++ b/codegen/Cms/Domains/ApiException.php @@ -10,13 +10,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/Domains/Configuration.php b/codegen/Cms/Domains/Configuration.php index 226db12aa..0cddd48ad 100644 --- a/codegen/Cms/Domains/Configuration.php +++ b/codegen/Cms/Domains/Configuration.php @@ -10,13 +10,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/Domains/HeaderSelector.php b/codegen/Cms/Domains/HeaderSelector.php index 017d84e87..e97e12cc9 100644 --- a/codegen/Cms/Domains/HeaderSelector.php +++ b/codegen/Cms/Domains/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php b/codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php index 1344a9a56..116b2f0fb 100644 --- a/codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php +++ b/codegen/Cms/Domains/Model/CollectionResponseWithTotalDomainForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Domains/Model/Domain.php b/codegen/Cms/Domains/Model/Domain.php index 10d180408..186ca361f 100644 --- a/codegen/Cms/Domains/Model/Domain.php +++ b/codegen/Cms/Domains/Model/Domain.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -353,10 +353,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('is_used_for_landing_page', $data ?? [], null); $this->setIfExists('primary_blog_post', $data ?? [], null); diff --git a/codegen/Cms/Domains/Model/Error.php b/codegen/Cms/Domains/Model/Error.php index ce5e3126c..ed0221442 100644 --- a/codegen/Cms/Domains/Model/Error.php +++ b/codegen/Cms/Domains/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Domains/Model/ErrorDetail.php b/codegen/Cms/Domains/Model/ErrorDetail.php index 7da1ede8e..8d8fd85e6 100644 --- a/codegen/Cms/Domains/Model/ErrorDetail.php +++ b/codegen/Cms/Domains/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/Domains/Model/ForwardPaging.php b/codegen/Cms/Domains/Model/ForwardPaging.php index deb0a23e8..28ff6cd4d 100644 --- a/codegen/Cms/Domains/Model/ForwardPaging.php +++ b/codegen/Cms/Domains/Model/ForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/Domains/Model/ModelInterface.php b/codegen/Cms/Domains/Model/ModelInterface.php index 64a817e8a..5401d7f33 100644 --- a/codegen/Cms/Domains/Model/ModelInterface.php +++ b/codegen/Cms/Domains/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/Domains/Model/NextPage.php b/codegen/Cms/Domains/Model/NextPage.php index cc1871a6c..dfd9bd60c 100644 --- a/codegen/Cms/Domains/Model/NextPage.php +++ b/codegen/Cms/Domains/Model/NextPage.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/Domains/ObjectSerializer.php b/codegen/Cms/Domains/ObjectSerializer.php index 9faff293d..e7b05dfe6 100644 --- a/codegen/Cms/Domains/ObjectSerializer.php +++ b/codegen/Cms/Domains/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * CMS Domains + * Domains * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/Hubdb/Api/RowsApi.php b/codegen/Cms/Hubdb/Api/RowsApi.php index 1bd0ce266..78168bdcb 100644 --- a/codegen/Cms/Hubdb/Api/RowsApi.php +++ b/codegen/Cms/Hubdb/Api/RowsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -107,13 +107,13 @@ class RowsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -153,7 +153,7 @@ public function getConfig() * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param string $name (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRow'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -173,7 +173,7 @@ public function cloneDraftTableRow($table_id_or_name, $row_id, $name = null, str * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param string $name (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRow'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -206,18 +206,6 @@ public function cloneDraftTableRowWithHttpInfo($table_id_or_name, $row_id, $name $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -276,6 +264,19 @@ public function cloneDraftTableRowWithHttpInfo($table_id_or_name, $row_id, $name ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -334,7 +335,7 @@ public function cloneDraftTableRowWithHttpInfo($table_id_or_name, $row_id, $name * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param string $name (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRow'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -357,7 +358,7 @@ function ($response) { * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param string $name (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRow'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -409,7 +410,7 @@ function ($exception) { * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param string $name (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cloneDraftTableRow'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -588,18 +589,6 @@ public function createTableRowWithHttpInfo($table_id_or_name, $hub_db_table_row_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -658,6 +647,19 @@ public function createTableRowWithHttpInfo($table_id_or_name, $hub_db_table_row_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -902,7 +904,7 @@ public function createTableRowRequest($table_id_or_name, $hub_db_table_row_v3_re * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableRowById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -922,7 +924,7 @@ public function getDraftTableRowById($table_id_or_name, $row_id, $archived = nul * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableRowById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -955,18 +957,6 @@ public function getDraftTableRowByIdWithHttpInfo($table_id_or_name, $row_id, $ar $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1025,6 +1015,19 @@ public function getDraftTableRowByIdWithHttpInfo($table_id_or_name, $row_id, $ar ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1083,7 +1086,7 @@ public function getDraftTableRowByIdWithHttpInfo($table_id_or_name, $row_id, $ar * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableRowById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1106,7 +1109,7 @@ function ($response) { * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableRowById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1158,7 +1161,7 @@ function ($exception) { * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableRowById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1286,7 +1289,7 @@ public function getDraftTableRowByIdRequest($table_id_or_name, $row_id, $archive * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRow'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1306,7 +1309,7 @@ public function getTableRow($table_id_or_name, $row_id, $archived = null, string * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRow'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1339,18 +1342,6 @@ public function getTableRowWithHttpInfo($table_id_or_name, $row_id, $archived = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1409,6 +1400,19 @@ public function getTableRowWithHttpInfo($table_id_or_name, $row_id, $archived = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1467,7 +1471,7 @@ public function getTableRowWithHttpInfo($table_id_or_name, $row_id, $archived = * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRow'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1490,7 +1494,7 @@ function ($response) { * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRow'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1542,7 +1546,7 @@ function ($exception) { * * @param string $table_id_or_name The ID or name of the table (required) * @param string $row_id The ID of the row (required) - * @param bool $archived (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRow'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1669,12 +1673,12 @@ public function getTableRowRequest($table_id_or_name, $row_id, $archived = null, * Get rows for a table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. See the above description for more details. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. See the above description for more details. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRows'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1693,12 +1697,12 @@ public function getTableRows($table_id_or_name, $sort = null, $after = null, $li * Get rows for a table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. See the above description for more details. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. See the above description for more details. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRows'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1731,18 +1735,6 @@ public function getTableRowsWithHttpInfo($table_id_or_name, $sort = null, $after $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1801,6 +1793,19 @@ public function getTableRowsWithHttpInfo($table_id_or_name, $sort = null, $after ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\UnifiedCollectionResponseWithTotalBaseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1858,12 +1863,12 @@ public function getTableRowsWithHttpInfo($table_id_or_name, $sort = null, $after * Get rows for a table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. See the above description for more details. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. See the above description for more details. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRows'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1885,12 +1890,12 @@ function ($response) { * Get rows for a table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. See the above description for more details. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. See the above description for more details. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRows'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1941,12 +1946,12 @@ function ($exception) { * Create request for operation 'getTableRows' * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. See the above description for more details. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. See the above description for more details. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableRows'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2156,18 +2161,6 @@ public function purgeDraftTableRowWithHttpInfo($table_id_or_name, $row_id, strin $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -2369,12 +2362,12 @@ public function purgeDraftTableRowRequest($table_id_or_name, $row_id, string $co * Get rows from draft table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -2393,12 +2386,12 @@ public function readDraftTableRows($table_id_or_name, $sort = null, $after = nul * Get rows from draft table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -2431,18 +2424,6 @@ public function readDraftTableRowsWithHttpInfo($table_id_or_name, $sort = null, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2501,6 +2482,19 @@ public function readDraftTableRowsWithHttpInfo($table_id_or_name, $sort = null, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\UnifiedCollectionResponseWithTotalBaseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2558,12 +2552,12 @@ public function readDraftTableRowsWithHttpInfo($table_id_or_name, $sort = null, * Get rows from draft table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2585,12 +2579,12 @@ function ($response) { * Get rows from draft table * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2641,12 +2635,12 @@ function ($exception) { * Create request for operation 'readDraftTableRows' * * @param string $table_id_or_name The ID or name of the table to query. (required) - * @param string[] $sort Specifies the column names to sort the results by. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is `1000`. (optional) - * @param string[] $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) - * @param int $offset (optional) - * @param bool $archived (optional) + * @param string[]|null $sort Specifies the column names to sort the results by. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is `1000`. (optional) + * @param string[]|null $properties Specify the column names to get results containing only the required columns instead of all column details. If you want to include multiple columns in the result, use this query param as many times. (optional) + * @param int|null $offset (optional) + * @param bool|null $archived (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readDraftTableRows'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2859,18 +2853,6 @@ public function replaceDraftTableRowWithHttpInfo($table_id_or_name, $row_id, $hu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2929,6 +2911,19 @@ public function replaceDraftTableRowWithHttpInfo($table_id_or_name, $row_id, $hu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3247,18 +3242,6 @@ public function updateDraftTableRowWithHttpInfo($table_id_or_name, $row_id, $hub $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3317,6 +3300,19 @@ public function updateDraftTableRowWithHttpInfo($table_id_or_name, $row_id, $hub ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Cms/Hubdb/Api/RowsBatchApi.php b/codegen/Cms/Hubdb/Api/RowsBatchApi.php index 7a89edc9d..6915d0262 100644 --- a/codegen/Cms/Hubdb/Api/RowsBatchApi.php +++ b/codegen/Cms/Hubdb/Api/RowsBatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -101,13 +101,13 @@ class RowsBatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -198,18 +198,6 @@ public function cloneDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -268,6 +256,19 @@ public function cloneDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -563,18 +564,6 @@ public function createDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -660,6 +649,19 @@ public function createDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -962,18 +964,6 @@ public function purgeDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1223,18 +1213,6 @@ public function readDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1320,6 +1298,19 @@ public function readDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input_s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1623,18 +1614,6 @@ public function readTableRowsWithHttpInfo($table_id_or_name, $batch_input_string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1720,6 +1699,19 @@ public function readTableRowsWithHttpInfo($table_id_or_name, $batch_input_string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2023,18 +2015,6 @@ public function replaceDraftTableRowsWithHttpInfo($table_id_or_name, $batch_inpu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2120,6 +2100,19 @@ public function replaceDraftTableRowsWithHttpInfo($table_id_or_name, $batch_inpu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2423,18 +2416,6 @@ public function updateDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2520,6 +2501,19 @@ public function updateDraftTableRowsWithHttpInfo($table_id_or_name, $batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\BatchResponseHubDbTableRowV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Cms/Hubdb/Api/TablesApi.php b/codegen/Cms/Hubdb/Api/TablesApi.php index 8144da584..169a8a221 100644 --- a/codegen/Cms/Hubdb/Api/TablesApi.php +++ b/codegen/Cms/Hubdb/Api/TablesApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -122,13 +122,13 @@ class TablesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -216,18 +216,6 @@ public function archiveTableWithHttpInfo($table_id_or_name, string $contentType $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -460,18 +448,6 @@ public function cloneDraftTableWithHttpInfo($table_id_or_name, $hub_db_table_clo $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -530,6 +506,19 @@ public function cloneDraftTableWithHttpInfo($table_id_or_name, $hub_db_table_clo ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -823,18 +812,6 @@ public function createTableWithHttpInfo($hub_db_table_v3_request, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -893,6 +870,19 @@ public function createTableWithHttpInfo($hub_db_table_v3_request, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1118,7 +1108,7 @@ public function createTableRequest($hub_db_table_v3_request, string $contentType * Export a draft table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1137,7 +1127,7 @@ public function exportDraftTable($table_id_or_name, $format = null, string $cont * Export a draft table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1170,18 +1160,6 @@ public function exportDraftTableWithHttpInfo($table_id_or_name, $format = null, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1240,6 +1218,19 @@ public function exportDraftTableWithHttpInfo($table_id_or_name, $format = null, ]; } + 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() + ); + } + $returnType = '\SplFileObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1297,7 +1288,7 @@ public function exportDraftTableWithHttpInfo($table_id_or_name, $format = null, * Export a draft table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1319,7 +1310,7 @@ function ($response) { * Export a draft table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1370,7 +1361,7 @@ function ($exception) { * Create request for operation 'exportDraftTable' * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1479,7 +1470,7 @@ public function exportDraftTableRequest($table_id_or_name, $format = null, strin * Export a published version of a table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1498,7 +1489,7 @@ public function exportTable($table_id_or_name, $format = null, string $contentTy * Export a published version of a table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1531,18 +1522,6 @@ public function exportTableWithHttpInfo($table_id_or_name, $format = null, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1601,6 +1580,19 @@ public function exportTableWithHttpInfo($table_id_or_name, $format = null, strin ]; } + 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() + ); + } + $returnType = '\SplFileObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1658,7 +1650,7 @@ public function exportTableWithHttpInfo($table_id_or_name, $format = null, strin * Export a published version of a table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1680,7 +1672,7 @@ function ($response) { * Export a published version of a table * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1731,7 +1723,7 @@ function ($exception) { * Create request for operation 'exportTable' * * @param string $table_id_or_name The ID or name of the table to export. (required) - * @param string $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) + * @param string|null $format The file format to export. Possible values include `CSV`, `XLSX`, and `XLS`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1839,17 +1831,17 @@ public function exportTableRequest($table_id_or_name, $format = null, string $co * * Return all draft tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllDraftTables'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1867,17 +1859,17 @@ public function getAllDraftTables($sort = null, $after = null, $limit = null, $c * * Return all draft tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllDraftTables'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -1910,18 +1902,6 @@ public function getAllDraftTablesWithHttpInfo($sort = null, $after = null, $limi $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1980,6 +1960,19 @@ public function getAllDraftTablesWithHttpInfo($sort = null, $after = null, $limi ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\CollectionResponseWithTotalHubDbTableV3ForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2036,17 +2029,17 @@ public function getAllDraftTablesWithHttpInfo($sort = null, $after = null, $limi * * Return all draft tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllDraftTables'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2067,17 +2060,17 @@ function ($response) { * * Return all draft tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllDraftTables'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2127,17 +2120,17 @@ function ($exception) { /** * Create request for operation 'getAllDraftTables' * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllDraftTables'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2330,17 +2323,17 @@ public function getAllDraftTablesRequest($sort = null, $after = null, $limit = n * * Get all published tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTables'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -2358,17 +2351,17 @@ public function getAllTables($sort = null, $after = null, $limit = null, $create * * Get all published tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTables'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -2401,18 +2394,6 @@ public function getAllTablesWithHttpInfo($sort = null, $after = null, $limit = n $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2471,6 +2452,19 @@ public function getAllTablesWithHttpInfo($sort = null, $after = null, $limit = n ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\CollectionResponseWithTotalHubDbTableV3ForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2527,17 +2521,17 @@ public function getAllTablesWithHttpInfo($sort = null, $after = null, $limit = n * * Get all published tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTables'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2558,17 +2552,17 @@ function ($response) { * * Get all published tables * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTables'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2618,17 +2612,17 @@ function ($exception) { /** * Create request for operation 'getAllTables' * - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 1000. (optional) - * @param \DateTime $created_at Only return tables created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return tables created after the specified time. (optional) - * @param \DateTime $created_before Only return tables created before the specified time. (optional) - * @param \DateTime $updated_at Only return tables last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return tables last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return tables last updated before the specified time. (optional) - * @param string $content_type (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 1000. (optional) + * @param \DateTime|null $created_at Only return tables created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return tables created after the specified time. (optional) + * @param \DateTime|null $created_before Only return tables created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return tables last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return tables last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return tables last updated before the specified time. (optional) + * @param string|null $content_type (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTables'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2822,9 +2816,9 @@ public function getAllTablesRequest($sort = null, $after = null, $limit = null, * Get details for a draft table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableDetailsById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -2843,9 +2837,9 @@ public function getDraftTableDetailsById($table_id_or_name, $is_get_localized_sc * Get details for a draft table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableDetailsById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -2878,18 +2872,6 @@ public function getDraftTableDetailsByIdWithHttpInfo($table_id_or_name, $is_get_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2948,6 +2930,19 @@ public function getDraftTableDetailsByIdWithHttpInfo($table_id_or_name, $is_get_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3005,9 +3000,9 @@ public function getDraftTableDetailsByIdWithHttpInfo($table_id_or_name, $is_get_ * Get details for a draft table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableDetailsById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3029,9 +3024,9 @@ function ($response) { * Get details for a draft table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableDetailsById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3082,9 +3077,9 @@ function ($exception) { * Create request for operation 'getDraftTableDetailsById' * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDraftTableDetailsById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3213,9 +3208,9 @@ public function getDraftTableDetailsByIdRequest($table_id_or_name, $is_get_local * Get details of a published table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -3234,9 +3229,9 @@ public function getTableDetails($table_id_or_name, $is_get_localized_schema = nu * Get details of a published table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -3269,18 +3264,6 @@ public function getTableDetailsWithHttpInfo($table_id_or_name, $is_get_localized $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3339,6 +3322,19 @@ public function getTableDetailsWithHttpInfo($table_id_or_name, $is_get_localized ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3396,9 +3392,9 @@ public function getTableDetailsWithHttpInfo($table_id_or_name, $is_get_localized * Get details of a published table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3420,9 +3416,9 @@ function ($response) { * Get details of a published table * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3473,9 +3469,9 @@ function ($exception) { * Create request for operation 'getTableDetails' * * @param string $table_id_or_name The ID or name of the table to return. (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Set this to `true` to return details for an archived table. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTableDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3604,8 +3600,8 @@ public function getTableDetailsRequest($table_id_or_name, $is_get_localized_sche * Import data into draft table * * @param string $table_id_or_name The ID of the destination table where data will be imported. (required) - * @param string $config config (optional) - * @param \SplFileObject $file file (optional) + * @param string|null $config config (optional) + * @param \SplFileObject|null $file file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -3624,8 +3620,8 @@ public function importDraftTable($table_id_or_name, $config = null, $file = null * Import data into draft table * * @param string $table_id_or_name The ID of the destination table where data will be imported. (required) - * @param string $config (optional) - * @param \SplFileObject $file (optional) + * @param string|null $config (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -3658,18 +3654,6 @@ public function importDraftTableWithHttpInfo($table_id_or_name, $config = null, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3728,6 +3712,19 @@ public function importDraftTableWithHttpInfo($table_id_or_name, $config = null, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\ImportResult'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3785,8 +3782,8 @@ public function importDraftTableWithHttpInfo($table_id_or_name, $config = null, * Import data into draft table * * @param string $table_id_or_name The ID of the destination table where data will be imported. (required) - * @param string $config (optional) - * @param \SplFileObject $file (optional) + * @param string|null $config (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3808,8 +3805,8 @@ function ($response) { * Import data into draft table * * @param string $table_id_or_name The ID of the destination table where data will be imported. (required) - * @param string $config (optional) - * @param \SplFileObject $file (optional) + * @param string|null $config (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3860,8 +3857,8 @@ function ($exception) { * Create request for operation 'importDraftTable' * * @param string $table_id_or_name The ID of the destination table where data will be imported. (required) - * @param string $config (optional) - * @param \SplFileObject $file (optional) + * @param string|null $config (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3915,6 +3912,7 @@ public function importDraftTableRequest($table_id_or_name, $config = null, $file } } + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*', ], $contentType, @@ -3978,7 +3976,7 @@ public function importDraftTableRequest($table_id_or_name, $config = null, $file * Publish a table from draft * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -3997,7 +3995,7 @@ public function publishDraftTable($table_id_or_name, $include_foreign_ids = null * Publish a table from draft * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -4030,18 +4028,6 @@ public function publishDraftTableWithHttpInfo($table_id_or_name, $include_foreig $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4100,6 +4086,19 @@ public function publishDraftTableWithHttpInfo($table_id_or_name, $include_foreig ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4157,7 +4156,7 @@ public function publishDraftTableWithHttpInfo($table_id_or_name, $include_foreig * Publish a table from draft * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4179,7 +4178,7 @@ function ($response) { * Publish a table from draft * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4230,7 +4229,7 @@ function ($exception) { * Create request for operation 'publishDraftTable' * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['publishDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4339,7 +4338,7 @@ public function publishDraftTableRequest($table_id_or_name, $include_foreign_ids * Reset a draft table * * @param string $table_id_or_name The ID or name of the table to reset. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -4358,7 +4357,7 @@ public function resetDraftTable($table_id_or_name, $include_foreign_ids = null, * Reset a draft table * * @param string $table_id_or_name The ID or name of the table to reset. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -4391,18 +4390,6 @@ public function resetDraftTableWithHttpInfo($table_id_or_name, $include_foreign_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4461,6 +4448,19 @@ public function resetDraftTableWithHttpInfo($table_id_or_name, $include_foreign_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4518,7 +4518,7 @@ public function resetDraftTableWithHttpInfo($table_id_or_name, $include_foreign_ * Reset a draft table * * @param string $table_id_or_name The ID or name of the table to reset. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4540,7 +4540,7 @@ function ($response) { * Reset a draft table * * @param string $table_id_or_name The ID or name of the table to reset. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4591,7 +4591,7 @@ function ($exception) { * Create request for operation 'resetDraftTable' * * @param string $table_id_or_name The ID or name of the table to reset. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4700,7 +4700,7 @@ public function resetDraftTableRequest($table_id_or_name, $include_foreign_ids = * Unpublish a table * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -4719,7 +4719,7 @@ public function unpublishTable($table_id_or_name, $include_foreign_ids = null, s * Unpublish a table * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -4752,18 +4752,6 @@ public function unpublishTableWithHttpInfo($table_id_or_name, $include_foreign_i $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4822,6 +4810,19 @@ public function unpublishTableWithHttpInfo($table_id_or_name, $include_foreign_i ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4879,7 +4880,7 @@ public function unpublishTableWithHttpInfo($table_id_or_name, $include_foreign_i * Unpublish a table * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4901,7 +4902,7 @@ function ($response) { * Unpublish a table * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4952,7 +4953,7 @@ function ($exception) { * Create request for operation 'unpublishTable' * * @param string $table_id_or_name The ID or name of the table to publish. (required) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unpublishTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5062,9 +5063,9 @@ public function unpublishTableRequest($table_id_or_name, $include_foreign_ids = * * @param string $table_id_or_name The ID or name of the table to update. (required) * @param \HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3Request $hub_db_table_v3_request hub_db_table_v3_request (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -5084,9 +5085,9 @@ public function updateDraftTable($table_id_or_name, $hub_db_table_v3_request, $i * * @param string $table_id_or_name The ID or name of the table to update. (required) * @param \HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3Request $hub_db_table_v3_request (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTable'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Hubdb\ApiException on non-2xx response or if the response body is not in the expected format @@ -5119,18 +5120,6 @@ public function updateDraftTableWithHttpInfo($table_id_or_name, $hub_db_table_v3 $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -5189,6 +5178,19 @@ public function updateDraftTableWithHttpInfo($table_id_or_name, $hub_db_table_v3 ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -5247,9 +5249,9 @@ public function updateDraftTableWithHttpInfo($table_id_or_name, $hub_db_table_v3 * * @param string $table_id_or_name The ID or name of the table to update. (required) * @param \HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3Request $hub_db_table_v3_request (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5272,9 +5274,9 @@ function ($response) { * * @param string $table_id_or_name The ID or name of the table to update. (required) * @param \HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3Request $hub_db_table_v3_request (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5326,9 +5328,9 @@ function ($exception) { * * @param string $table_id_or_name The ID or name of the table to update. (required) * @param \HubSpot\Client\Cms\Hubdb\Model\HubDbTableV3Request $hub_db_table_v3_request (required) - * @param bool $is_get_localized_schema (optional) - * @param bool $archived Specifies whether to return archived tables. Defaults to `false`. (optional) - * @param bool $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) + * @param bool|null $is_get_localized_schema (optional) + * @param bool|null $archived Specifies whether to return archived tables. Defaults to `false`. (optional) + * @param bool|null $include_foreign_ids Set this to `true` to populate foreign ID values in the result. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDraftTable'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Cms/Hubdb/ApiException.php b/codegen/Cms/Hubdb/ApiException.php index 42e3eeba9..6926824e5 100644 --- a/codegen/Cms/Hubdb/ApiException.php +++ b/codegen/Cms/Hubdb/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/Hubdb/Configuration.php b/codegen/Cms/Hubdb/Configuration.php index 233cc4641..31d973def 100644 --- a/codegen/Cms/Hubdb/Configuration.php +++ b/codegen/Cms/Hubdb/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/Hubdb/HeaderSelector.php b/codegen/Cms/Hubdb/HeaderSelector.php index d651b9ae1..637d09350 100644 --- a/codegen/Cms/Hubdb/HeaderSelector.php +++ b/codegen/Cms/Hubdb/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowBatchCloneRequest.php b/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowBatchCloneRequest.php index f7d5c5e1a..109c19afb 100644 --- a/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowBatchCloneRequest.php +++ b/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowBatchCloneRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3BatchUpdateRequest.php b/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3BatchUpdateRequest.php index 463f9df55..c000566f8 100644 --- a/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3BatchUpdateRequest.php +++ b/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3BatchUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3Request.php b/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3Request.php index 2bf40a223..3293a98b0 100644 --- a/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3Request.php +++ b/codegen/Cms/Hubdb/Model/BatchInputHubDbTableRowV3Request.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Hubdb/Model/BatchInputString.php b/codegen/Cms/Hubdb/Model/BatchInputString.php index 2c0605f22..fd434a82d 100644 --- a/codegen/Cms/Hubdb/Model/BatchInputString.php +++ b/codegen/Cms/Hubdb/Model/BatchInputString.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3.php b/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3.php index 2837a1f26..a2f5fcc2c 100644 --- a/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3.php +++ b/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3WithErrors.php b/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3WithErrors.php index 9c0af7a20..e019b0427 100644 --- a/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3WithErrors.php +++ b/codegen/Cms/Hubdb/Model/BatchResponseHubDbTableRowV3WithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/BoundedNextPage.php b/codegen/Cms/Hubdb/Model/BoundedNextPage.php index 378621c9c..67a17384f 100644 --- a/codegen/Cms/Hubdb/Model/BoundedNextPage.php +++ b/codegen/Cms/Hubdb/Model/BoundedNextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('offset', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/BoundedPaging.php b/codegen/Cms/Hubdb/Model/BoundedPaging.php index 40e85497d..c9c9b33e4 100644 --- a/codegen/Cms/Hubdb/Model/BoundedPaging.php +++ b/codegen/Cms/Hubdb/Model/BoundedPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php b/codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php index b089dfc07..2fbb2ce5b 100644 --- a/codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php +++ b/codegen/Cms/Hubdb/Model/CollectionResponseWithTotalHubDbTableV3ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/Column.php b/codegen/Cms/Hubdb/Model/Column.php index d836aedc3..a98b09b7a 100644 --- a/codegen/Cms/Hubdb/Model/Column.php +++ b/codegen/Cms/Hubdb/Model/Column.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -404,10 +404,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_by_user_id', $data ?? [], null); $this->setIfExists('foreign_table_id', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/ColumnRequest.php b/codegen/Cms/Hubdb/Model/ColumnRequest.php index 20fd8e085..85e2845e4 100644 --- a/codegen/Cms/Hubdb/Model/ColumnRequest.php +++ b/codegen/Cms/Hubdb/Model/ColumnRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -326,10 +326,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('foreign_table_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/Error.php b/codegen/Cms/Hubdb/Model/Error.php index 265c7ead0..67b78c4e1 100644 --- a/codegen/Cms/Hubdb/Model/Error.php +++ b/codegen/Cms/Hubdb/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/ErrorDetail.php b/codegen/Cms/Hubdb/Model/ErrorDetail.php index bb30eda09..c7183e0d4 100644 --- a/codegen/Cms/Hubdb/Model/ErrorDetail.php +++ b/codegen/Cms/Hubdb/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/ForeignId.php b/codegen/Cms/Hubdb/Model/ForeignId.php index ff6cba3bb..778a7c34a 100644 --- a/codegen/Cms/Hubdb/Model/ForeignId.php +++ b/codegen/Cms/Hubdb/Model/ForeignId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/ForwardPaging.php b/codegen/Cms/Hubdb/Model/ForwardPaging.php index 389b45b31..6911fea98 100644 --- a/codegen/Cms/Hubdb/Model/ForwardPaging.php +++ b/codegen/Cms/Hubdb/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/Hubdb/Model/HubDbTableCloneRequest.php b/codegen/Cms/Hubdb/Model/HubDbTableCloneRequest.php index 377abd0af..4a254e81f 100644 --- a/codegen/Cms/Hubdb/Model/HubDbTableCloneRequest.php +++ b/codegen/Cms/Hubdb/Model/HubDbTableCloneRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('new_name', $data ?? [], null); $this->setIfExists('is_hubspot_defined', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/HubDbTableRowBatchCloneRequest.php b/codegen/Cms/Hubdb/Model/HubDbTableRowBatchCloneRequest.php index 933223ec2..9e35ee215 100644 --- a/codegen/Cms/Hubdb/Model/HubDbTableRowBatchCloneRequest.php +++ b/codegen/Cms/Hubdb/Model/HubDbTableRowBatchCloneRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/HubDbTableRowV3.php b/codegen/Cms/Hubdb/Model/HubDbTableRowV3.php index b84351eda..da978ceba 100644 --- a/codegen/Cms/Hubdb/Model/HubDbTableRowV3.php +++ b/codegen/Cms/Hubdb/Model/HubDbTableRowV3.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('path', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/HubDbTableRowV3BatchUpdateRequest.php b/codegen/Cms/Hubdb/Model/HubDbTableRowV3BatchUpdateRequest.php index a151f3fee..b6299943f 100644 --- a/codegen/Cms/Hubdb/Model/HubDbTableRowV3BatchUpdateRequest.php +++ b/codegen/Cms/Hubdb/Model/HubDbTableRowV3BatchUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('path', $data ?? [], null); $this->setIfExists('child_table_id', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/HubDbTableRowV3Request.php b/codegen/Cms/Hubdb/Model/HubDbTableRowV3Request.php index 5352cec95..392bf3d63 100644 --- a/codegen/Cms/Hubdb/Model/HubDbTableRowV3Request.php +++ b/codegen/Cms/Hubdb/Model/HubDbTableRowV3Request.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('path', $data ?? [], null); $this->setIfExists('child_table_id', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/HubDbTableV3.php b/codegen/Cms/Hubdb/Model/HubDbTableV3.php index 46013e9c4..c44fd7b90 100644 --- a/codegen/Cms/Hubdb/Model/HubDbTableV3.php +++ b/codegen/Cms/Hubdb/Model/HubDbTableV3.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -347,10 +347,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('dynamic_meta_tags', $data ?? [], null); $this->setIfExists('updated_by', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/HubDbTableV3Request.php b/codegen/Cms/Hubdb/Model/HubDbTableV3Request.php index 61f3b9c9b..8536f85fa 100644 --- a/codegen/Cms/Hubdb/Model/HubDbTableV3Request.php +++ b/codegen/Cms/Hubdb/Model/HubDbTableV3Request.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('dynamic_meta_tags', $data ?? [], null); $this->setIfExists('allow_public_api_access', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/ImportResult.php b/codegen/Cms/Hubdb/Model/ImportResult.php index 6aec95fed..09976c40f 100644 --- a/codegen/Cms/Hubdb/Model/ImportResult.php +++ b/codegen/Cms/Hubdb/Model/ImportResult.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('row_limit_exceeded', $data ?? [], null); $this->setIfExists('duplicate_rows', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/ModelInterface.php b/codegen/Cms/Hubdb/Model/ModelInterface.php index 89118094a..bb60d9b21 100644 --- a/codegen/Cms/Hubdb/Model/ModelInterface.php +++ b/codegen/Cms/Hubdb/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/Hubdb/Model/NextPage.php b/codegen/Cms/Hubdb/Model/NextPage.php index 342a4279f..9dd35ee0d 100644 --- a/codegen/Cms/Hubdb/Model/NextPage.php +++ b/codegen/Cms/Hubdb/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/Option.php b/codegen/Cms/Hubdb/Model/Option.php index 34739d91d..04627d15f 100644 --- a/codegen/Cms/Hubdb/Model/Option.php +++ b/codegen/Cms/Hubdb/Model/Option.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -299,10 +299,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_by_user_id', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/Paging.php b/codegen/Cms/Hubdb/Model/Paging.php index 7a56ca8e2..6504e028c 100644 --- a/codegen/Cms/Hubdb/Model/Paging.php +++ b/codegen/Cms/Hubdb/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/PreviousPage.php b/codegen/Cms/Hubdb/Model/PreviousPage.php index c976ad217..510e7831d 100644 --- a/codegen/Cms/Hubdb/Model/PreviousPage.php +++ b/codegen/Cms/Hubdb/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/RandomAccessCollectionResponseWithTotalHubDbTableRowV3.php b/codegen/Cms/Hubdb/Model/RandomAccessCollectionResponseWithTotalHubDbTableRowV3.php index 38de10310..e40ec2b7f 100644 --- a/codegen/Cms/Hubdb/Model/RandomAccessCollectionResponseWithTotalHubDbTableRowV3.php +++ b/codegen/Cms/Hubdb/Model/RandomAccessCollectionResponseWithTotalHubDbTableRowV3.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/SimpleUser.php b/codegen/Cms/Hubdb/Model/SimpleUser.php index 2a1adf77b..95d4bb270 100644 --- a/codegen/Cms/Hubdb/Model/SimpleUser.php +++ b/codegen/Cms/Hubdb/Model/SimpleUser.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('first_name', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/StandardError.php b/codegen/Cms/Hubdb/Model/StandardError.php index 9a43cace6..d217244b2 100644 --- a/codegen/Cms/Hubdb/Model/StandardError.php +++ b/codegen/Cms/Hubdb/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); @@ -369,7 +369,7 @@ public function getSubCategory() /** * Sets sub_category * - * @param object|null $sub_category + * @param object|null $sub_category Identifies the subcategory of the error, providing more specific context within the main category. * * @return self */ @@ -396,7 +396,7 @@ public function getContext() /** * Sets context * - * @param array $context + * @param array $context An object containing context-specific information pertinent to the error. * * @return self */ @@ -423,7 +423,7 @@ public function getLinks() /** * Sets links * - * @param array $links + * @param array $links An object containing links related to the error, such as documentation URLs or support contact pages. * * @return self */ @@ -450,7 +450,7 @@ public function getId() /** * Sets id * - * @param string|null $id + * @param string|null $id The unique ID of the error instance. * * @return self */ @@ -477,7 +477,7 @@ public function getCategory() /** * Sets category * - * @param string $category + * @param string $category Specifies the main category of the error, determining the broad area of issue. * * @return self */ @@ -504,7 +504,7 @@ public function getMessage() /** * Sets message * - * @param string $message + * @param string $message A detailed message describing the error. * * @return self */ @@ -558,7 +558,7 @@ public function getStatus() /** * Sets status * - * @param string $status + * @param string $status The HTTP status code associated with the error. * * @return self */ diff --git a/codegen/Cms/Hubdb/Model/StreamingCollectionResponseWithTotalHubDbTableRowV3.php b/codegen/Cms/Hubdb/Model/StreamingCollectionResponseWithTotalHubDbTableRowV3.php index 12fdd58bf..2e16f4271 100644 --- a/codegen/Cms/Hubdb/Model/StreamingCollectionResponseWithTotalHubDbTableRowV3.php +++ b/codegen/Cms/Hubdb/Model/StreamingCollectionResponseWithTotalHubDbTableRowV3.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/Model/UnifiedCollectionResponseWithTotalBaseHubDbTableRowV3.php b/codegen/Cms/Hubdb/Model/UnifiedCollectionResponseWithTotalBaseHubDbTableRowV3.php index 6445d5869..fd93e4ae1 100644 --- a/codegen/Cms/Hubdb/Model/UnifiedCollectionResponseWithTotalBaseHubDbTableRowV3.php +++ b/codegen/Cms/Hubdb/Model/UnifiedCollectionResponseWithTotalBaseHubDbTableRowV3.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -272,10 +272,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Hubdb/ObjectSerializer.php b/codegen/Cms/Hubdb/ObjectSerializer.php index 488b791c5..bc8b3d732 100644 --- a/codegen/Cms/Hubdb/ObjectSerializer.php +++ b/codegen/Cms/Hubdb/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/Pages/Api/LandingPagesApi.php b/codegen/Cms/Pages/Api/LandingPagesApi.php index f908fb41b..3a7143717 100644 --- a/codegen/Cms/Pages/Api/LandingPagesApi.php +++ b/codegen/Cms/Pages/Api/LandingPagesApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -197,13 +197,13 @@ class LandingPagesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -242,7 +242,7 @@ public function getConfig() * Delete a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -260,7 +260,7 @@ public function archive($object_id, $archived = null, string $contentType = self * Delete a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -293,18 +293,6 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -329,7 +317,7 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten * Delete a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -351,7 +339,7 @@ function ($response) { * Delete a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -389,7 +377,7 @@ function ($exception) { * Create request for operation 'archive' * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -547,18 +535,6 @@ public function archiveBatchWithHttpInfo($batch_input_string, string $contentTyp $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -738,7 +714,7 @@ public function archiveBatchRequest($batch_input_string, string $contentType = s * Delete a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveFolder'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -756,7 +732,7 @@ public function archiveFolder($object_id, $archived = null, string $contentType * Delete a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveFolder'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -789,18 +765,6 @@ public function archiveFolderWithHttpInfo($object_id, $archived = null, string $ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -825,7 +789,7 @@ public function archiveFolderWithHttpInfo($object_id, $archived = null, string $ * Delete a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveFolder'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -847,7 +811,7 @@ function ($response) { * Delete a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveFolder'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -885,7 +849,7 @@ function ($exception) { * Create request for operation 'archiveFolder' * * @param string $object_id The Folder id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveFolder'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1043,18 +1007,6 @@ public function archiveFoldersWithHttpInfo($batch_input_string, string $contentT $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1283,18 +1235,6 @@ public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1524,18 +1464,6 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1594,6 +1522,19 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1868,18 +1809,6 @@ public function createWithHttpInfo($page, string $contentType = self::contentTyp $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -2117,18 +2046,6 @@ public function createABTestVariationWithHttpInfo($ab_test_create_request_v_next $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -2187,6 +2104,19 @@ public function createABTestVariationWithHttpInfo($ab_test_create_request_v_next ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2462,18 +2392,6 @@ public function createBatchWithHttpInfo($batch_input_page, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -2559,6 +2477,19 @@ public function createBatchWithHttpInfo($batch_input_page, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2842,18 +2773,6 @@ public function createFolderWithHttpInfo($content_folder, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -2912,6 +2831,19 @@ public function createFolderWithHttpInfo($content_folder, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\ContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3187,18 +3119,6 @@ public function createFoldersWithHttpInfo($batch_input_content_folder, string $c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -3284,6 +3204,19 @@ public function createFoldersWithHttpInfo($batch_input_content_folder, string $c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponseContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3567,18 +3500,6 @@ public function createLangVariationWithHttpInfo($content_language_clone_request_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3637,6 +3558,19 @@ public function createLangVariationWithHttpInfo($content_language_clone_request_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3911,18 +3845,6 @@ public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -4151,18 +4073,6 @@ public function endActiveABTestWithHttpInfo($ab_test_end_request_v_next, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -4342,8 +4252,8 @@ public function endActiveABTestRequest($ab_test_end_request_v_next, string $cont * Retrieve a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -4362,8 +4272,8 @@ public function getById($object_id, $archived = null, $property = null, string $ * Retrieve a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -4396,18 +4306,6 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4466,6 +4364,19 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4523,8 +4434,8 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu * Retrieve a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4546,8 +4457,8 @@ function ($response) { * Retrieve a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4598,8 +4509,8 @@ function ($exception) { * Create request for operation 'getById' * * @param string $object_id The Landing Page id. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4768,18 +4679,6 @@ public function getDraftByIdWithHttpInfo($object_id, string $contentType = self: $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4838,6 +4737,19 @@ public function getDraftByIdWithHttpInfo($object_id, string $contentType = self: ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -5064,8 +4976,8 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont * Retrieve a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -5084,8 +4996,8 @@ public function getFolderById($object_id, $archived = null, $property = null, st * Retrieve a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -5118,18 +5030,6 @@ public function getFolderByIdWithHttpInfo($object_id, $archived = null, $propert $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -5188,6 +5088,19 @@ public function getFolderByIdWithHttpInfo($object_id, $archived = null, $propert ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\ContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -5245,8 +5158,8 @@ public function getFolderByIdWithHttpInfo($object_id, $archived = null, $propert * Retrieve a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5268,8 +5181,8 @@ function ($response) { * Retrieve a Folder * * @param string $object_id The Folder id. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5320,8 +5233,8 @@ function ($exception) { * Create request for operation 'getFolderById' * * @param string $object_id The Folder id. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5492,18 +5405,6 @@ public function getFolderPreviousVersionWithHttpInfo($object_id, $revision_id, s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -5562,6 +5463,19 @@ public function getFolderPreviousVersionWithHttpInfo($object_id, $revision_id, s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\VersionContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -5806,9 +5720,9 @@ public function getFolderPreviousVersionRequest($object_id, $revision_id, string * Retrieves all the previous versions of a Folder * * @param string $object_id The Folder id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -5827,9 +5741,9 @@ public function getFolderPreviousVersions($object_id, $after = null, $before = n * Retrieves all the previous versions of a Folder * * @param string $object_id The Folder id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -5862,18 +5776,6 @@ public function getFolderPreviousVersionsWithHttpInfo($object_id, $after = null, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -5932,6 +5834,19 @@ public function getFolderPreviousVersionsWithHttpInfo($object_id, $after = null, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -5989,9 +5904,9 @@ public function getFolderPreviousVersionsWithHttpInfo($object_id, $after = null, * Retrieves all the previous versions of a Folder * * @param string $object_id The Folder id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6013,9 +5928,9 @@ function ($response) { * Retrieves all the previous versions of a Folder * * @param string $object_id The Folder id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6066,9 +5981,9 @@ function ($exception) { * Create request for operation 'getFolderPreviousVersions' * * @param string $object_id The Folder id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFolderPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6196,17 +6111,17 @@ public function getFolderPreviousVersionsRequest($object_id, $after = null, $bef * * Get all Landing Page Folders * - * @param \DateTime $created_at Only return Folders created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Folders created after the specified time. (optional) - * @param \DateTime $created_before Only return Folders created before the specified time. (optional) - * @param \DateTime $updated_at Only return Folders last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Folders last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Folders last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param \DateTime|null $created_at Only return Folders created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Folders created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Folders created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Folders last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Folders last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Folders last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFoldersPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -6224,17 +6139,17 @@ public function getFoldersPage($created_at = null, $created_after = null, $creat * * Get all Landing Page Folders * - * @param \DateTime $created_at Only return Folders created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Folders created after the specified time. (optional) - * @param \DateTime $created_before Only return Folders created before the specified time. (optional) - * @param \DateTime $updated_at Only return Folders last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Folders last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Folders last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Folders created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Folders created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Folders created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Folders last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Folders last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Folders last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFoldersPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -6267,18 +6182,6 @@ public function getFoldersPageWithHttpInfo($created_at = null, $created_after = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -6337,6 +6240,19 @@ public function getFoldersPageWithHttpInfo($created_at = null, $created_after = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalContentFolderForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -6393,17 +6309,17 @@ public function getFoldersPageWithHttpInfo($created_at = null, $created_after = * * Get all Landing Page Folders * - * @param \DateTime $created_at Only return Folders created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Folders created after the specified time. (optional) - * @param \DateTime $created_before Only return Folders created before the specified time. (optional) - * @param \DateTime $updated_at Only return Folders last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Folders last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Folders last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Folders created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Folders created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Folders created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Folders last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Folders last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Folders last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFoldersPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6424,17 +6340,17 @@ function ($response) { * * Get all Landing Page Folders * - * @param \DateTime $created_at Only return Folders created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Folders created after the specified time. (optional) - * @param \DateTime $created_before Only return Folders created before the specified time. (optional) - * @param \DateTime $updated_at Only return Folders last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Folders last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Folders last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Folders created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Folders created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Folders created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Folders last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Folders last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Folders last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFoldersPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6484,17 +6400,17 @@ function ($exception) { /** * Create request for operation 'getFoldersPage' * - * @param \DateTime $created_at Only return Folders created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Folders created after the specified time. (optional) - * @param \DateTime $created_before Only return Folders created before the specified time. (optional) - * @param \DateTime $updated_at Only return Folders last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Folders last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Folders last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Folders created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Folders created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Folders created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Folders last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Folders last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Folders last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFoldersPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6687,17 +6603,17 @@ public function getFoldersPageRequest($created_at = null, $created_after = null, * * Get all Landing Pages * - * @param \DateTime $created_at Only return Landing Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Landing Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Landing Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Landing Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Landing Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param \DateTime|null $created_at Only return Landing Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Landing Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Landing Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Landing Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Landing Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -6715,17 +6631,17 @@ public function getPage($created_at = null, $created_after = null, $created_befo * * Get all Landing Pages * - * @param \DateTime $created_at Only return Landing Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Landing Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Landing Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Landing Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Landing Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Landing Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Landing Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Landing Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Landing Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Landing Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -6758,18 +6674,6 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -6828,6 +6732,19 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalPageForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -6884,17 +6801,17 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ * * Get all Landing Pages * - * @param \DateTime $created_at Only return Landing Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Landing Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Landing Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Landing Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Landing Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Landing Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Landing Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Landing Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Landing Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Landing Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6915,17 +6832,17 @@ function ($response) { * * Get all Landing Pages * - * @param \DateTime $created_at Only return Landing Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Landing Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Landing Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Landing Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Landing Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Landing Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Landing Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Landing Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Landing Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Landing Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -6975,17 +6892,17 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param \DateTime $created_at Only return Landing Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Landing Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Landing Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Landing Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Landing Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Landing Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Landing Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Landing Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Landing Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Landing Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Landing Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -7231,18 +7148,6 @@ public function getPreviousVersionWithHttpInfo($object_id, $revision_id, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -7301,6 +7206,19 @@ public function getPreviousVersionWithHttpInfo($object_id, $revision_id, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\VersionPage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -7545,9 +7463,9 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont * Retrieves all the previous versions of a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -7566,9 +7484,9 @@ public function getPreviousVersions($object_id, $after = null, $before = null, $ * Retrieves all the previous versions of a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -7601,18 +7519,6 @@ public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $befo $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -7671,6 +7577,19 @@ public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $befo ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -7728,9 +7647,9 @@ public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $befo * Retrieves all the previous versions of a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -7752,9 +7671,9 @@ function ($response) { * Retrieves all the previous versions of a Landing Page * * @param string $object_id The Landing Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -7805,9 +7724,9 @@ function ($exception) { * Create request for operation 'getPreviousVersions' * * @param string $object_id The Landing Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -7985,18 +7904,6 @@ public function pushLiveWithHttpInfo($object_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -8177,7 +8084,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT * Retrieve a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Landing Page ids. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -8196,7 +8103,7 @@ public function readBatch($batch_input_string, $archived = null, string $content * Retrieve a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Landing Page ids. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -8229,18 +8136,6 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -8326,6 +8221,19 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -8391,7 +8299,7 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str * Retrieve a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Landing Page ids. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8413,7 +8321,7 @@ function ($response) { * Retrieve a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Landing Page ids. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8464,7 +8372,7 @@ function ($exception) { * Create request for operation 'readBatch' * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Landing Page ids. (required) - * @param bool $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8572,7 +8480,7 @@ public function readBatchRequest($batch_input_string, $archived = null, string $ * Retrieve a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Folder ids. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readFolders'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -8591,7 +8499,7 @@ public function readFolders($batch_input_string, $archived = null, string $conte * Retrieve a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Folder ids. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readFolders'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -8624,18 +8532,6 @@ public function readFoldersWithHttpInfo($batch_input_string, $archived = null, s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -8721,6 +8617,19 @@ public function readFoldersWithHttpInfo($batch_input_string, $archived = null, s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponseContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -8786,7 +8695,7 @@ public function readFoldersWithHttpInfo($batch_input_string, $archived = null, s * Retrieve a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Folder ids. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readFolders'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8808,7 +8717,7 @@ function ($response) { * Retrieve a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Folder ids. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readFolders'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8859,7 +8768,7 @@ function ($exception) { * Create request for operation 'readFolders' * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Folder ids. (required) - * @param bool $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readFolders'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -9016,18 +8925,6 @@ public function rerunPreviousABTestWithHttpInfo($ab_test_rerun_request_v_next, s $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -9256,18 +9153,6 @@ public function resetDraftWithHttpInfo($object_id, string $contentType = self::c $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -9500,18 +9385,6 @@ public function restoreFolderPreviousVersionWithHttpInfo($object_id, $revision_i $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -9570,6 +9443,19 @@ public function restoreFolderPreviousVersionWithHttpInfo($object_id, $revision_i ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\ContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -9866,18 +9752,6 @@ public function restorePreviousVersionWithHttpInfo($object_id, $revision_id, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -9936,6 +9810,19 @@ public function restorePreviousVersionWithHttpInfo($object_id, $revision_id, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -10232,18 +10119,6 @@ public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -10302,6 +10177,19 @@ public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -10595,18 +10483,6 @@ public function scheduleWithHttpInfo($content_schedule_request_v_next, string $c $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -10835,18 +10711,6 @@ public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_n $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -11027,7 +10891,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, * * @param string $object_id The Landing Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Landing Page. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -11047,7 +10911,7 @@ public function update($object_id, $page, $archived = null, string $contentType * * @param string $object_id The Landing Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Landing Page. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -11080,18 +10944,6 @@ public function updateWithHttpInfo($object_id, $page, $archived = null, string $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -11150,6 +11002,19 @@ public function updateWithHttpInfo($object_id, $page, $archived = null, string $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -11208,7 +11073,7 @@ public function updateWithHttpInfo($object_id, $page, $archived = null, string $ * * @param string $object_id The Landing Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Landing Page. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -11231,7 +11096,7 @@ function ($response) { * * @param string $object_id The Landing Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Landing Page. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -11283,7 +11148,7 @@ function ($exception) { * * @param string $object_id The Landing Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Landing Page. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -11406,7 +11271,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte * Update a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Landing Pages. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -11425,7 +11290,7 @@ public function updateBatch($batch_input_json_node, $archived = null, string $co * Update a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Landing Pages. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -11458,18 +11323,6 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -11555,6 +11408,19 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -11620,7 +11486,7 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null * Update a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Landing Pages. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -11642,7 +11508,7 @@ function ($response) { * Update a batch of Landing Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Landing Pages. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -11693,7 +11559,7 @@ function ($exception) { * Create request for operation 'updateBatch' * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Landing Pages. (required) - * @param bool $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Landing Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -11853,18 +11719,6 @@ public function updateDraftWithHttpInfo($object_id, $page, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -11923,6 +11777,19 @@ public function updateDraftWithHttpInfo($object_id, $page, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -12167,7 +12034,7 @@ public function updateDraftRequest($object_id, $page, string $contentType = self * * @param string $object_id The Folder id. (required) * @param \HubSpot\Client\Cms\Pages\Model\ContentFolder $content_folder The JSON representation of the updated Folder. (required) - * @param bool $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -12187,7 +12054,7 @@ public function updateFolder($object_id, $content_folder, $archived = null, stri * * @param string $object_id The Folder id. (required) * @param \HubSpot\Client\Cms\Pages\Model\ContentFolder $content_folder The JSON representation of the updated Folder. (required) - * @param bool $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -12220,18 +12087,6 @@ public function updateFolderWithHttpInfo($object_id, $content_folder, $archived $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -12290,6 +12145,19 @@ public function updateFolderWithHttpInfo($object_id, $content_folder, $archived ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\ContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -12348,7 +12216,7 @@ public function updateFolderWithHttpInfo($object_id, $content_folder, $archived * * @param string $object_id The Folder id. (required) * @param \HubSpot\Client\Cms\Pages\Model\ContentFolder $content_folder The JSON representation of the updated Folder. (required) - * @param bool $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -12371,7 +12239,7 @@ function ($response) { * * @param string $object_id The Folder id. (required) * @param \HubSpot\Client\Cms\Pages\Model\ContentFolder $content_folder The JSON representation of the updated Folder. (required) - * @param bool $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -12423,7 +12291,7 @@ function ($exception) { * * @param string $object_id The Folder id. (required) * @param \HubSpot\Client\Cms\Pages\Model\ContentFolder $content_folder The JSON representation of the updated Folder. (required) - * @param bool $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Folders. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolder'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -12546,7 +12414,7 @@ public function updateFolderRequest($object_id, $content_folder, $archived = nul * Update a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node batch_input_json_node (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolders'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -12565,7 +12433,7 @@ public function updateFolders($batch_input_json_node, $archived = null, string $ * Update a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolders'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -12598,18 +12466,6 @@ public function updateFoldersWithHttpInfo($batch_input_json_node, $archived = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -12695,6 +12551,19 @@ public function updateFoldersWithHttpInfo($batch_input_json_node, $archived = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponseContentFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -12760,7 +12629,7 @@ public function updateFoldersWithHttpInfo($batch_input_json_node, $archived = nu * Update a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolders'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -12782,7 +12651,7 @@ function ($response) { * Update a batch of Folders * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolders'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -12833,7 +12702,7 @@ function ($exception) { * Create request for operation 'updateFolders' * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateFolders'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -12990,18 +12859,6 @@ public function updateLangsWithHttpInfo($update_languages_request_v_next, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; diff --git a/codegen/Cms/Pages/Api/SitePagesApi.php b/codegen/Cms/Pages/Api/SitePagesApi.php index 84a537aae..28e5dd554 100644 --- a/codegen/Cms/Pages/Api/SitePagesApi.php +++ b/codegen/Cms/Pages/Api/SitePagesApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -161,13 +161,13 @@ class SitePagesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -206,7 +206,7 @@ public function getConfig() * Delete a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -224,7 +224,7 @@ public function archive($object_id, $archived = null, string $contentType = self * Delete a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -257,18 +257,6 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -293,7 +281,7 @@ public function archiveWithHttpInfo($object_id, $archived = null, string $conten * Delete a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -315,7 +303,7 @@ function ($response) { * Delete a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -353,7 +341,7 @@ function ($exception) { * Create request for operation 'archive' * * @param string $object_id The Site Page id. (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -511,18 +499,6 @@ public function archiveBatchWithHttpInfo($batch_input_string, string $contentTyp $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -751,18 +727,6 @@ public function attachToLangGroupWithHttpInfo($attach_to_lang_primary_request_v_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -992,18 +956,6 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1062,6 +1014,19 @@ public function callCloneWithHttpInfo($content_clone_request_v_next, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1336,18 +1301,6 @@ public function createWithHttpInfo($page, string $contentType = self::contentTyp $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1585,18 +1538,6 @@ public function createABTestVariationWithHttpInfo($ab_test_create_request_v_next $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -1655,6 +1596,19 @@ public function createABTestVariationWithHttpInfo($ab_test_create_request_v_next ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1930,18 +1884,6 @@ public function createBatchWithHttpInfo($batch_input_page, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -2027,6 +1969,19 @@ public function createBatchWithHttpInfo($batch_input_page, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2310,18 +2265,6 @@ public function createLangVariationWithHttpInfo($content_language_clone_request_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2380,6 +2323,19 @@ public function createLangVariationWithHttpInfo($content_language_clone_request_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2654,18 +2610,6 @@ public function detachFromLangGroupWithHttpInfo($detach_from_lang_group_request_ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -2894,18 +2838,6 @@ public function endActiveABTestWithHttpInfo($ab_test_end_request_v_next, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -3085,8 +3017,8 @@ public function endActiveABTestRequest($ab_test_end_request_v_next, string $cont * Retrieve a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -3105,8 +3037,8 @@ public function getById($object_id, $archived = null, $property = null, string $ * Retrieve a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -3139,18 +3071,6 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3209,6 +3129,19 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3266,8 +3199,8 @@ public function getByIdWithHttpInfo($object_id, $archived = null, $property = nu * Retrieve a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3289,8 +3222,8 @@ function ($response) { * Retrieve a Site Page * * @param string $object_id The Site Page id. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3341,8 +3274,8 @@ function ($exception) { * Create request for operation 'getById' * * @param string $object_id The Site Page id. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3511,18 +3444,6 @@ public function getDraftByIdWithHttpInfo($object_id, string $contentType = self: $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3581,6 +3502,19 @@ public function getDraftByIdWithHttpInfo($object_id, string $contentType = self: ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3806,17 +3740,17 @@ public function getDraftByIdRequest($object_id, string $contentType = self::cont * * Get all Site Pages * - * @param \DateTime $created_at Only return Site Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Site Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Site Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Site Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Site Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Site Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property property (optional) + * @param \DateTime|null $created_at Only return Site Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Site Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Site Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Site Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Site Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Site Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -3834,17 +3768,17 @@ public function getPage($created_at = null, $created_after = null, $created_befo * * Get all Site Pages * - * @param \DateTime $created_at Only return Site Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Site Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Site Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Site Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Site Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Site Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Site Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Site Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Site Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Site Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Site Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Site Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -3877,18 +3811,6 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3947,6 +3869,19 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalPageForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4003,17 +3938,17 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ * * Get all Site Pages * - * @param \DateTime $created_at Only return Site Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Site Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Site Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Site Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Site Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Site Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Site Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Site Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Site Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Site Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Site Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Site Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4034,17 +3969,17 @@ function ($response) { * * Get all Site Pages * - * @param \DateTime $created_at Only return Site Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Site Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Site Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Site Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Site Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Site Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Site Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Site Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Site Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Site Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Site Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Site Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4094,17 +4029,17 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param \DateTime $created_at Only return Site Pages created at exactly the specified time. (optional) - * @param \DateTime $created_after Only return Site Pages created after the specified time. (optional) - * @param \DateTime $created_before Only return Site Pages created before the specified time. (optional) - * @param \DateTime $updated_at Only return Site Pages last updated at exactly the specified time. (optional) - * @param \DateTime $updated_after Only return Site Pages last updated after the specified time. (optional) - * @param \DateTime $updated_before Only return Site Pages last updated before the specified time. (optional) - * @param string[] $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) - * @param string $property (optional) + * @param \DateTime|null $created_at Only return Site Pages created at exactly the specified time. (optional) + * @param \DateTime|null $created_after Only return Site Pages created after the specified time. (optional) + * @param \DateTime|null $created_before Only return Site Pages created before the specified time. (optional) + * @param \DateTime|null $updated_at Only return Site Pages last updated at exactly the specified time. (optional) + * @param \DateTime|null $updated_after Only return Site Pages last updated after the specified time. (optional) + * @param \DateTime|null $updated_before Only return Site Pages last updated before the specified time. (optional) + * @param string[]|null $sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` will be used by default. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param string|null $property (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4350,18 +4285,6 @@ public function getPreviousVersionWithHttpInfo($object_id, $revision_id, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4420,6 +4343,19 @@ public function getPreviousVersionWithHttpInfo($object_id, $revision_id, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\VersionPage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4664,9 +4600,9 @@ public function getPreviousVersionRequest($object_id, $revision_id, string $cont * Retrieves all the previous versions of a Site Page * * @param string $object_id The Site Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -4685,9 +4621,9 @@ public function getPreviousVersions($object_id, $after = null, $before = null, $ * Retrieves all the previous versions of a Site Page * * @param string $object_id The Site Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -4720,18 +4656,6 @@ public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $befo $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -4790,6 +4714,19 @@ public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $befo ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\CollectionResponseWithTotalVersionPage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4847,9 +4784,9 @@ public function getPreviousVersionsWithHttpInfo($object_id, $after = null, $befo * Retrieves all the previous versions of a Site Page * * @param string $object_id The Site Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4871,9 +4808,9 @@ function ($response) { * Retrieves all the previous versions of a Site Page * * @param string $object_id The Site Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4924,9 +4861,9 @@ function ($exception) { * Create request for operation 'getPreviousVersions' * * @param string $object_id The Site Page id. (required) - * @param string $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to return. Default is 100. (optional) + * @param string|null $after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to return. Default is 100. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPreviousVersions'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5104,18 +5041,6 @@ public function pushLiveWithHttpInfo($object_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -5296,7 +5221,7 @@ public function pushLiveRequest($object_id, string $contentType = self::contentT * Retrieve a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -5315,7 +5240,7 @@ public function readBatch($batch_input_string, $archived = null, string $content * Retrieve a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -5348,18 +5273,6 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -5445,6 +5358,19 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -5510,7 +5436,7 @@ public function readBatchWithHttpInfo($batch_input_string, $archived = null, str * Retrieve a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5532,7 +5458,7 @@ function ($response) { * Retrieve a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5583,7 +5509,7 @@ function ($exception) { * Create request for operation 'readBatch' * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputString $batch_input_string The JSON array of Site Page ids. (required) - * @param bool $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to return deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['readBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -5740,18 +5666,6 @@ public function rerunPreviousABTestWithHttpInfo($ab_test_rerun_request_v_next, s $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -5980,18 +5894,6 @@ public function resetDraftWithHttpInfo($object_id, string $contentType = self::c $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -6224,18 +6126,6 @@ public function restorePreviousVersionWithHttpInfo($object_id, $revision_id, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -6294,6 +6184,19 @@ public function restorePreviousVersionWithHttpInfo($object_id, $revision_id, str ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -6590,18 +6493,6 @@ public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -6660,6 +6551,19 @@ public function restorePreviousVersionToDraftWithHttpInfo($object_id, $revision_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -6953,18 +6857,6 @@ public function scheduleWithHttpInfo($content_schedule_request_v_next, string $c $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -7193,18 +7085,6 @@ public function setLangPrimaryWithHttpInfo($set_new_language_primary_request_v_n $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -7385,7 +7265,7 @@ public function setLangPrimaryRequest($set_new_language_primary_request_v_next, * * @param string $object_id The Site Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Site Page. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -7405,7 +7285,7 @@ public function update($object_id, $page, $archived = null, string $contentType * * @param string $object_id The Site Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Site Page. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -7438,18 +7318,6 @@ public function updateWithHttpInfo($object_id, $page, $archived = null, string $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -7508,6 +7376,19 @@ public function updateWithHttpInfo($object_id, $page, $archived = null, string $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -7566,7 +7447,7 @@ public function updateWithHttpInfo($object_id, $page, $archived = null, string $ * * @param string $object_id The Site Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Site Page. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -7589,7 +7470,7 @@ function ($response) { * * @param string $object_id The Site Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Site Page. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -7641,7 +7522,7 @@ function ($exception) { * * @param string $object_id The Site Page id. (required) * @param \HubSpot\Client\Cms\Pages\Model\Page $page The JSON representation of the updated Site Page. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -7764,7 +7645,7 @@ public function updateRequest($object_id, $page, $archived = null, string $conte * Update a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Site Pages. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -7783,7 +7664,7 @@ public function updateBatch($batch_input_json_node, $archived = null, string $co * Update a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Site Pages. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\Pages\ApiException on non-2xx response or if the response body is not in the expected format @@ -7816,18 +7697,6 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -7913,6 +7782,19 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\BatchResponsePage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -7978,7 +7860,7 @@ public function updateBatchWithHttpInfo($batch_input_json_node, $archived = null * Update a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Site Pages. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8000,7 +7882,7 @@ function ($response) { * Update a batch of Site Pages * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Site Pages. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8051,7 +7933,7 @@ function ($exception) { * Create request for operation 'updateBatch' * * @param \HubSpot\Client\Cms\Pages\Model\BatchInputJsonNode $batch_input_json_node The JSON representation of the updated Site Pages. (required) - * @param bool $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) + * @param bool|null $archived Specifies whether to update deleted Site Pages. Defaults to `false`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBatch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -8211,18 +8093,6 @@ public function updateDraftWithHttpInfo($object_id, $page, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -8281,6 +8151,19 @@ public function updateDraftWithHttpInfo($object_id, $page, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\Pages\Model\Page'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -8573,18 +8456,6 @@ public function updateLangsWithHttpInfo($update_languages_request_v_next, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; diff --git a/codegen/Cms/Pages/ApiException.php b/codegen/Cms/Pages/ApiException.php index 0bc0e64b2..957db140d 100644 --- a/codegen/Cms/Pages/ApiException.php +++ b/codegen/Cms/Pages/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/Pages/Configuration.php b/codegen/Cms/Pages/Configuration.php index 46c50f9ae..1c3b1cf1e 100644 --- a/codegen/Cms/Pages/Configuration.php +++ b/codegen/Cms/Pages/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/Pages/HeaderSelector.php b/codegen/Cms/Pages/HeaderSelector.php index c584c15d0..15d573734 100644 --- a/codegen/Cms/Pages/HeaderSelector.php +++ b/codegen/Cms/Pages/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/Pages/Model/AbTestCreateRequestVNext.php b/codegen/Cms/Pages/Model/AbTestCreateRequestVNext.php index d05fbefec..c066ee150 100644 --- a/codegen/Cms/Pages/Model/AbTestCreateRequestVNext.php +++ b/codegen/Cms/Pages/Model/AbTestCreateRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('variation_name', $data ?? [], null); $this->setIfExists('content_id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/AbTestEndRequestVNext.php b/codegen/Cms/Pages/Model/AbTestEndRequestVNext.php index 560e9ef9c..798a340b6 100644 --- a/codegen/Cms/Pages/Model/AbTestEndRequestVNext.php +++ b/codegen/Cms/Pages/Model/AbTestEndRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('winner_id', $data ?? [], null); $this->setIfExists('ab_test_id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/AbTestRerunRequestVNext.php b/codegen/Cms/Pages/Model/AbTestRerunRequestVNext.php index 751e90a30..efcea51b6 100644 --- a/codegen/Cms/Pages/Model/AbTestRerunRequestVNext.php +++ b/codegen/Cms/Pages/Model/AbTestRerunRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('variation_id', $data ?? [], null); $this->setIfExists('ab_test_id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/Angle.php b/codegen/Cms/Pages/Model/Angle.php index 0ebb419af..7cb54a435 100644 --- a/codegen/Cms/Pages/Model/Angle.php +++ b/codegen/Cms/Pages/Model/Angle.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('units', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/AttachToLangPrimaryRequestVNext.php b/codegen/Cms/Pages/Model/AttachToLangPrimaryRequestVNext.php index 4cc77876d..87a189faa 100644 --- a/codegen/Cms/Pages/Model/AttachToLangPrimaryRequestVNext.php +++ b/codegen/Cms/Pages/Model/AttachToLangPrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('language', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/BackgroundImage.php b/codegen/Cms/Pages/Model/BackgroundImage.php index 692e77187..65ed9ecb1 100644 --- a/codegen/Cms/Pages/Model/BackgroundImage.php +++ b/codegen/Cms/Pages/Model/BackgroundImage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('image_url', $data ?? [], null); $this->setIfExists('background_size', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/BatchInputContentFolder.php b/codegen/Cms/Pages/Model/BatchInputContentFolder.php index bfac6615e..bfdc2f830 100644 --- a/codegen/Cms/Pages/Model/BatchInputContentFolder.php +++ b/codegen/Cms/Pages/Model/BatchInputContentFolder.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/BatchInputJsonNode.php b/codegen/Cms/Pages/Model/BatchInputJsonNode.php index 045c27ce1..a38d938ea 100644 --- a/codegen/Cms/Pages/Model/BatchInputJsonNode.php +++ b/codegen/Cms/Pages/Model/BatchInputJsonNode.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/BatchInputPage.php b/codegen/Cms/Pages/Model/BatchInputPage.php index f544debee..9652b9e9b 100644 --- a/codegen/Cms/Pages/Model/BatchInputPage.php +++ b/codegen/Cms/Pages/Model/BatchInputPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/BatchInputString.php b/codegen/Cms/Pages/Model/BatchInputString.php index aecc8022e..f9c8d0624 100644 --- a/codegen/Cms/Pages/Model/BatchInputString.php +++ b/codegen/Cms/Pages/Model/BatchInputString.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/BatchResponseContentFolder.php b/codegen/Cms/Pages/Model/BatchResponseContentFolder.php index 101aad392..93b563c98 100644 --- a/codegen/Cms/Pages/Model/BatchResponseContentFolder.php +++ b/codegen/Cms/Pages/Model/BatchResponseContentFolder.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -289,10 +289,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/BatchResponseContentFolderWithErrors.php b/codegen/Cms/Pages/Model/BatchResponseContentFolderWithErrors.php index ac2cf005d..c0c5a0fc6 100644 --- a/codegen/Cms/Pages/Model/BatchResponseContentFolderWithErrors.php +++ b/codegen/Cms/Pages/Model/BatchResponseContentFolderWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -301,10 +301,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/BatchResponsePage.php b/codegen/Cms/Pages/Model/BatchResponsePage.php index fef504ba3..b7a81cf06 100644 --- a/codegen/Cms/Pages/Model/BatchResponsePage.php +++ b/codegen/Cms/Pages/Model/BatchResponsePage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -289,10 +289,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/BatchResponsePageWithErrors.php b/codegen/Cms/Pages/Model/BatchResponsePageWithErrors.php index 0aca79a30..f88a91b83 100644 --- a/codegen/Cms/Pages/Model/BatchResponsePageWithErrors.php +++ b/codegen/Cms/Pages/Model/BatchResponsePageWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -301,10 +301,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/CollectionResponseWithTotalContentFolderForwardPaging.php b/codegen/Cms/Pages/Model/CollectionResponseWithTotalContentFolderForwardPaging.php index 10252eb97..b89a0815a 100644 --- a/codegen/Cms/Pages/Model/CollectionResponseWithTotalContentFolderForwardPaging.php +++ b/codegen/Cms/Pages/Model/CollectionResponseWithTotalContentFolderForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/CollectionResponseWithTotalPageForwardPaging.php b/codegen/Cms/Pages/Model/CollectionResponseWithTotalPageForwardPaging.php index ad7c4dde7..d2d6c268a 100644 --- a/codegen/Cms/Pages/Model/CollectionResponseWithTotalPageForwardPaging.php +++ b/codegen/Cms/Pages/Model/CollectionResponseWithTotalPageForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php b/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php index fd5f531ed..24026c0aa 100644 --- a/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php +++ b/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionContentFolder.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionPage.php b/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionPage.php index 183e006b2..601371eb5 100644 --- a/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionPage.php +++ b/codegen/Cms/Pages/Model/CollectionResponseWithTotalVersionPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ColorStop.php b/codegen/Cms/Pages/Model/ColorStop.php index ed9746d76..3a9edd704 100644 --- a/codegen/Cms/Pages/Model/ColorStop.php +++ b/codegen/Cms/Pages/Model/ColorStop.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('color', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/ContentCloneRequestVNext.php b/codegen/Cms/Pages/Model/ContentCloneRequestVNext.php index fa0f93d5a..bf3916736 100644 --- a/codegen/Cms/Pages/Model/ContentCloneRequestVNext.php +++ b/codegen/Cms/Pages/Model/ContentCloneRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('clone_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ContentFolder.php b/codegen/Cms/Pages/Model/ContentFolder.php index a93b867ca..683727c12 100644 --- a/codegen/Cms/Pages/Model/ContentFolder.php +++ b/codegen/Cms/Pages/Model/ContentFolder.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('deleted_at', $data ?? [], null); $this->setIfExists('parent_folder_id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ContentLanguageCloneRequestVNext.php b/codegen/Cms/Pages/Model/ContentLanguageCloneRequestVNext.php index ac215ad33..513ef000a 100644 --- a/codegen/Cms/Pages/Model/ContentLanguageCloneRequestVNext.php +++ b/codegen/Cms/Pages/Model/ContentLanguageCloneRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('language', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ContentLanguageVariation.php b/codegen/Cms/Pages/Model/ContentLanguageVariation.php index dd0c01285..77fd5b299 100644 --- a/codegen/Cms/Pages/Model/ContentLanguageVariation.php +++ b/codegen/Cms/Pages/Model/ContentLanguageVariation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -317,10 +317,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('archived_in_dashboard', $data ?? [], null); $this->setIfExists('created', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ContentScheduleRequestVNext.php b/codegen/Cms/Pages/Model/ContentScheduleRequestVNext.php index df779bbcd..93ca56cf5 100644 --- a/codegen/Cms/Pages/Model/ContentScheduleRequestVNext.php +++ b/codegen/Cms/Pages/Model/ContentScheduleRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('publish_date', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/DetachFromLangGroupRequestVNext.php b/codegen/Cms/Pages/Model/DetachFromLangGroupRequestVNext.php index 3e6d11d94..d3f840337 100644 --- a/codegen/Cms/Pages/Model/DetachFromLangGroupRequestVNext.php +++ b/codegen/Cms/Pages/Model/DetachFromLangGroupRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/Error.php b/codegen/Cms/Pages/Model/Error.php index 9d9143e02..64112543c 100644 --- a/codegen/Cms/Pages/Model/Error.php +++ b/codegen/Cms/Pages/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ErrorDetail.php b/codegen/Cms/Pages/Model/ErrorDetail.php index 058cbc11b..7c401aa27 100644 --- a/codegen/Cms/Pages/Model/ErrorDetail.php +++ b/codegen/Cms/Pages/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ForwardPaging.php b/codegen/Cms/Pages/Model/ForwardPaging.php index 6f8f69092..b587e7207 100644 --- a/codegen/Cms/Pages/Model/ForwardPaging.php +++ b/codegen/Cms/Pages/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/Gradient.php b/codegen/Cms/Pages/Model/Gradient.php index bc6288434..ed3c59a0e 100644 --- a/codegen/Cms/Pages/Model/Gradient.php +++ b/codegen/Cms/Pages/Model/Gradient.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('angle', $data ?? [], null); $this->setIfExists('side_or_corner', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/LayoutSection.php b/codegen/Cms/Pages/Model/LayoutSection.php index 2fe36c81e..7812c81e6 100644 --- a/codegen/Cms/Pages/Model/LayoutSection.php +++ b/codegen/Cms/Pages/Model/LayoutSection.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -311,10 +311,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('css_style', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/ModelInterface.php b/codegen/Cms/Pages/Model/ModelInterface.php index 0203d87a2..eee7c6b21 100644 --- a/codegen/Cms/Pages/Model/ModelInterface.php +++ b/codegen/Cms/Pages/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/Pages/Model/NextPage.php b/codegen/Cms/Pages/Model/NextPage.php index e1b6a0cb2..b5c94b253 100644 --- a/codegen/Cms/Pages/Model/NextPage.php +++ b/codegen/Cms/Pages/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/Page.php b/codegen/Cms/Pages/Model/Page.php index ad9d43c25..639812d2d 100644 --- a/codegen/Cms/Pages/Model/Page.php +++ b/codegen/Cms/Pages/Model/Page.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -2232,10 +2232,10 @@ public function getCurrentStateAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('publish_date', $data ?? [], null); $this->setIfExists('language', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/Paging.php b/codegen/Cms/Pages/Model/Paging.php index bb4b19276..14fab9b77 100644 --- a/codegen/Cms/Pages/Model/Paging.php +++ b/codegen/Cms/Pages/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/PreviousPage.php b/codegen/Cms/Pages/Model/PreviousPage.php index 116c5e562..e36be4bd1 100644 --- a/codegen/Cms/Pages/Model/PreviousPage.php +++ b/codegen/Cms/Pages/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/RGBAColor.php b/codegen/Cms/Pages/Model/RGBAColor.php index 78218c99c..a621763b4 100644 --- a/codegen/Cms/Pages/Model/RGBAColor.php +++ b/codegen/Cms/Pages/Model/RGBAColor.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('a', $data ?? [], null); $this->setIfExists('r', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/RowMetaData.php b/codegen/Cms/Pages/Model/RowMetaData.php index b40fe33d2..5fc87f419 100644 --- a/codegen/Cms/Pages/Model/RowMetaData.php +++ b/codegen/Cms/Pages/Model/RowMetaData.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('css_class', $data ?? [], null); $this->setIfExists('styles', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/SetNewLanguagePrimaryRequestVNext.php b/codegen/Cms/Pages/Model/SetNewLanguagePrimaryRequestVNext.php index 1067158df..4b3beaf6e 100644 --- a/codegen/Cms/Pages/Model/SetNewLanguagePrimaryRequestVNext.php +++ b/codegen/Cms/Pages/Model/SetNewLanguagePrimaryRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Cms/Pages/Model/SideOrCorner.php b/codegen/Cms/Pages/Model/SideOrCorner.php index 2bfb65e19..92735e54b 100644 --- a/codegen/Cms/Pages/Model/SideOrCorner.php +++ b/codegen/Cms/Pages/Model/SideOrCorner.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('horizontal_side', $data ?? [], null); $this->setIfExists('vertical_side', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/StandardError.php b/codegen/Cms/Pages/Model/StandardError.php index 360a9e9df..124ba1e2c 100644 --- a/codegen/Cms/Pages/Model/StandardError.php +++ b/codegen/Cms/Pages/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/Styles.php b/codegen/Cms/Pages/Model/Styles.php index 131aefe62..c7ff00746 100644 --- a/codegen/Cms/Pages/Model/Styles.php +++ b/codegen/Cms/Pages/Model/Styles.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('background_color', $data ?? [], null); $this->setIfExists('flexbox_positioning', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/UpdateLanguagesRequestVNext.php b/codegen/Cms/Pages/Model/UpdateLanguagesRequestVNext.php index c06eb02fd..3aa8d4593 100644 --- a/codegen/Cms/Pages/Model/UpdateLanguagesRequestVNext.php +++ b/codegen/Cms/Pages/Model/UpdateLanguagesRequestVNext.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('languages', $data ?? [], null); $this->setIfExists('primary_id', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/VersionContentFolder.php b/codegen/Cms/Pages/Model/VersionContentFolder.php index e899c8a3a..65582b595 100644 --- a/codegen/Cms/Pages/Model/VersionContentFolder.php +++ b/codegen/Cms/Pages/Model/VersionContentFolder.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('user', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/VersionPage.php b/codegen/Cms/Pages/Model/VersionPage.php index 42122787b..bae25f8da 100644 --- a/codegen/Cms/Pages/Model/VersionPage.php +++ b/codegen/Cms/Pages/Model/VersionPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('user', $data ?? [], null); diff --git a/codegen/Cms/Pages/Model/VersionUser.php b/codegen/Cms/Pages/Model/VersionUser.php index f7850bd41..519646d6d 100644 --- a/codegen/Cms/Pages/Model/VersionUser.php +++ b/codegen/Cms/Pages/Model/VersionUser.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('full_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/Pages/ObjectSerializer.php b/codegen/Cms/Pages/ObjectSerializer.php index 6466347b7..a162189a4 100644 --- a/codegen/Cms/Pages/ObjectSerializer.php +++ b/codegen/Cms/Pages/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/Performance/ApiException.php b/codegen/Cms/Performance/ApiException.php deleted file mode 100644 index d9bf257bb..000000000 --- a/codegen/Cms/Performance/ApiException.php +++ /dev/null @@ -1,119 +0,0 @@ -responseHeaders = $responseHeaders; - $this->responseBody = $responseBody; - } - - /** - * Gets the HTTP response header - * - * @return string[]|null HTTP response header - */ - public function getResponseHeaders() - { - return $this->responseHeaders; - } - - /** - * Gets the HTTP body of the server response either as Json or string - * - * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string - */ - public function getResponseBody() - { - return $this->responseBody; - } - - /** - * Sets the deserialized response object (during deserialization) - * - * @param mixed $obj Deserialized response object - * - * @return void - */ - public function setResponseObject($obj) - { - $this->responseObject = $obj; - } - - /** - * Gets the deserialized response object (during deserialization) - * - * @return mixed the deserialized response object - */ - public function getResponseObject() - { - return $this->responseObject; - } -} diff --git a/codegen/Cms/Performance/Configuration.php b/codegen/Cms/Performance/Configuration.php deleted file mode 100644 index 00f23fdc6..000000000 --- a/codegen/Cms/Performance/Configuration.php +++ /dev/null @@ -1,531 +0,0 @@ -tempFolderPath = sys_get_temp_dir(); - } - - /** - * Sets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $key API key or token - * - * @return $this - */ - public function setApiKey($apiKeyIdentifier, $key) - { - $this->apiKeys[$apiKeyIdentifier] = $key; - return $this; - } - - /** - * Gets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string API key or token - */ - public function getApiKey($apiKeyIdentifier) - { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; - } - - /** - * Sets the prefix for API key (e.g. Bearer) - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $prefix API key prefix, e.g. Bearer - * - * @return $this - */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) - { - $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; - return $this; - } - - /** - * Gets API key prefix - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string - */ - public function getApiKeyPrefix($apiKeyIdentifier) - { - return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; - } - - /** - * Sets the access token for OAuth - * - * @param string $accessToken Token for OAuth - * - * @return $this - */ - public function setAccessToken($accessToken) - { - $this->accessToken = $accessToken; - return $this; - } - - /** - * Gets the access token for OAuth - * - * @return string Access token for OAuth - */ - public function getAccessToken() - { - return $this->accessToken; - } - - /** - * Sets boolean format for query string. - * - * @param string $booleanFormat Boolean format for query string - * - * @return $this - */ - public function setBooleanFormatForQueryString(string $booleanFormat) - { - $this->booleanFormatForQueryString = $booleanFormat; - - return $this; - } - - /** - * Gets boolean format for query string. - * - * @return string Boolean format for query string - */ - public function getBooleanFormatForQueryString(): string - { - return $this->booleanFormatForQueryString; - } - - /** - * Sets the username for HTTP basic authentication - * - * @param string $username Username for HTTP basic authentication - * - * @return $this - */ - public function setUsername($username) - { - $this->username = $username; - return $this; - } - - /** - * Gets the username for HTTP basic authentication - * - * @return string Username for HTTP basic authentication - */ - public function getUsername() - { - return $this->username; - } - - /** - * Sets the password for HTTP basic authentication - * - * @param string $password Password for HTTP basic authentication - * - * @return $this - */ - public function setPassword($password) - { - $this->password = $password; - return $this; - } - - /** - * Gets the password for HTTP basic authentication - * - * @return string Password for HTTP basic authentication - */ - public function getPassword() - { - return $this->password; - } - - /** - * Sets the host - * - * @param string $host Host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - return $this; - } - - /** - * Gets the host - * - * @return string Host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the user agent of the api client - * - * @param string $userAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * @return $this - */ - public function setUserAgent($userAgent) - { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->userAgent = $userAgent; - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getUserAgent() - { - return $this->userAgent; - } - - /** - * Sets debug flag - * - * @param bool $debug Debug flag - * - * @return $this - */ - public function setDebug($debug) - { - $this->debug = $debug; - return $this; - } - - /** - * Gets the debug flag - * - * @return bool - */ - public function getDebug() - { - return $this->debug; - } - - /** - * Sets the debug file - * - * @param string $debugFile Debug file - * - * @return $this - */ - public function setDebugFile($debugFile) - { - $this->debugFile = $debugFile; - return $this; - } - - /** - * Gets the debug file - * - * @return string - */ - public function getDebugFile() - { - return $this->debugFile; - } - - /** - * Sets the temp folder path - * - * @param string $tempFolderPath Temp folder path - * - * @return $this - */ - public function setTempFolderPath($tempFolderPath) - { - $this->tempFolderPath = $tempFolderPath; - return $this; - } - - /** - * Gets the temp folder path - * - * @return string Temp folder path - */ - public function getTempFolderPath() - { - return $this->tempFolderPath; - } - - /** - * Gets the default configuration instance - * - * @return Configuration - */ - public static function getDefaultConfiguration() - { - if (self::$defaultConfiguration === null) { - self::$defaultConfiguration = new Configuration(); - } - - return self::$defaultConfiguration; - } - - /** - * Sets the default configuration instance - * - * @param Configuration $config An instance of the Configuration Object - * - * @return void - */ - public static function setDefaultConfiguration(Configuration $config) - { - self::$defaultConfiguration = $config; - } - - /** - * Gets the essential information for debugging - * - * @return string The report for debugging - */ - public static function toDebugReport() - { - $report = 'PHP SDK (HubSpot\Client\Cms\Performance) Debug Report:' . PHP_EOL; - $report .= ' OS: ' . php_uname() . PHP_EOL; - $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' The version of the OpenAPI document: v3' . PHP_EOL; - $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; - - return $report; - } - - /** - * Get API key (with prefix if set) - * - * @param string $apiKeyIdentifier name of apikey - * - * @return null|string API key with the prefix - */ - public function getApiKeyWithPrefix($apiKeyIdentifier) - { - $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); - $apiKey = $this->getApiKey($apiKeyIdentifier); - - if ($apiKey === null) { - return null; - } - - if ($prefix === null) { - $keyWithPrefix = $apiKey; - } else { - $keyWithPrefix = $prefix . ' ' . $apiKey; - } - - return $keyWithPrefix; - } - - /** - * Returns an array of host settings - * - * @return array an array of host settings - */ - public function getHostSettings() - { - return [ - [ - "url" => "https://api.hubapi.com", - "description" => "No description provided", - ] - ]; - } - - /** - * Returns URL based on host settings, index and variables - * - * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients - * @param int $hostIndex index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) - { - if (null === $variables) { - $variables = []; - } - - // check array index out of bound - if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { - throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); - } - - $host = $hostSettings[$hostIndex]; - $url = $host["url"]; - - // go through variable and assign a value - foreach ($host["variables"] ?? [] as $name => $variable) { - if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum - $url = str_replace("{".$name."}", $variables[$name], $url); - } else { - throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); - } - } else { - // use default value - $url = str_replace("{".$name."}", $variable["default_value"], $url); - } - } - - return $url; - } - - /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) - { - return self::getHostString($this->getHostSettings(), $index, $variables); - } -} diff --git a/codegen/Cms/Performance/HeaderSelector.php b/codegen/Cms/Performance/HeaderSelector.php deleted file mode 100644 index 274f3b512..000000000 --- a/codegen/Cms/Performance/HeaderSelector.php +++ /dev/null @@ -1,245 +0,0 @@ -selectAcceptHeader($accept); - if ($accept !== null) { - $headers['Accept'] = $accept; - } - - if (!$isMultipart) { - if($contentType === '') { - $contentType = 'application/json'; - } - - $headers['Content-Type'] = $contentType; - } - - return $headers; - } - - /** - * Return the header 'Accept' based on an array of Accept provided. - * - * @param string[] $accept Array of header - * - * @return null|string Accept (e.g. application/json) - */ - private function selectAcceptHeader(array $accept): ?string - { - # filter out empty entries - $accept = array_filter($accept); - - if (count($accept) === 0) { - return null; - } - - # If there's only one Accept header, just use it - if (count($accept) === 1) { - return reset($accept); - } - - # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); - if (count($headersWithJson) === 0) { - return implode(',', $accept); - } - - # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, - # to give the highest priority to json-like headers - recalculating the existing ones, if needed - return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); - } - - /** - * Create an Accept header string from the given "Accept" headers array, recalculating all weights - * - * @param string[] $accept Array of Accept Headers - * @param string[] $headersWithJson Array of Accept Headers of type "json" - * - * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") - */ - private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string - { - $processedHeaders = [ - 'withApplicationJson' => [], - 'withJson' => [], - 'withoutJson' => [], - ]; - - foreach ($accept as $header) { - - $headerData = $this->getHeaderAndWeight($header); - - if (stripos($headerData['header'], 'application/json') === 0) { - $processedHeaders['withApplicationJson'][] = $headerData; - } elseif (in_array($header, $headersWithJson, true)) { - $processedHeaders['withJson'][] = $headerData; - } else { - $processedHeaders['withoutJson'][] = $headerData; - } - } - - $acceptHeaders = []; - $currentWeight = 1000; - - $hasMoreThan28Headers = count($accept) > 28; - - foreach($processedHeaders as $headers) { - if (count($headers) > 0) { - $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); - } - } - - $acceptHeaders = array_merge(...$acceptHeaders); - - return implode(',', $acceptHeaders); - } - - /** - * Given an Accept header, returns an associative array splitting the header and its weight - * - * @param string $header "Accept" Header - * - * @return array with the header and its weight - */ - private function getHeaderAndWeight(string $header): array - { - # matches headers with weight, splitting the header and the weight in $outputArray - if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { - $headerData = [ - 'header' => $outputArray[1], - 'weight' => (int)($outputArray[2] * 1000), - ]; - } else { - $headerData = [ - 'header' => trim($header), - 'weight' => 1000, - ]; - } - - return $headerData; - } - - /** - * @param array[] $headers - * @param float $currentWeight - * @param bool $hasMoreThan28Headers - * @return string[] array of adjusted "Accept" headers - */ - private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array - { - usort($headers, function (array $a, array $b) { - return $b['weight'] - $a['weight']; - }); - - $acceptHeaders = []; - foreach ($headers as $index => $header) { - if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) - { - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - } - - $weight = $currentWeight; - - $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); - } - - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - - return $acceptHeaders; - } - - /** - * @param string $header - * @param int $weight - * @return string - */ - private function buildAcceptHeader(string $header, int $weight): string - { - if($weight === 1000) { - return $header; - } - - return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); - } - - /** - * Calculate the next weight, based on the current one. - * - * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the - * following formula: - * - * next weight = current weight - 10 ^ (floor(log(current weight - 1))) - * - * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) - * - * Starting from 1000, this generates the following series: - * - * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - * - * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works - * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 - * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. - * - * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) - * @param bool $hasMoreThan28Headers - * @return int - */ - public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int - { - if ($currentWeight <= 1) { - return 1; - } - - if ($hasMoreThan28Headers) { - return $currentWeight - 1; - } - - return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); - } -} diff --git a/codegen/Cms/Performance/Model/ModelInterface.php b/codegen/Cms/Performance/Model/ModelInterface.php deleted file mode 100644 index c9cd04b20..000000000 --- a/codegen/Cms/Performance/Model/ModelInterface.php +++ /dev/null @@ -1,111 +0,0 @@ - - */ -class PerformanceView implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'PerformanceView'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - '_403' => 'int', - '_404' => 'int', - '_500' => 'int', - '_504' => 'int', - 'start_datetime' => 'string', - 'response_time_ms' => 'int', - '_95th' => 'int', - 'total_requests' => 'int', - 'cache_hit_rate' => 'float', - '_99th' => 'int', - 'total_request_time' => 'int', - '_100_x' => 'int', - '_50th' => 'int', - 'cache_hits' => 'int', - '_20_x' => 'int', - '_30_x' => 'int', - '_40_x' => 'int', - 'end_timestamp' => 'int', - '_50_x' => 'int', - 'start_timestamp' => 'int', - 'end_datetime' => 'string', - 'avg_origin_response_time' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - '_403' => 'int32', - '_404' => 'int32', - '_500' => 'int32', - '_504' => 'int32', - 'start_datetime' => null, - 'response_time_ms' => 'int32', - '_95th' => 'int32', - 'total_requests' => 'int32', - 'cache_hit_rate' => null, - '_99th' => 'int32', - 'total_request_time' => 'int32', - '_100_x' => 'int32', - '_50th' => 'int32', - 'cache_hits' => 'int32', - '_20_x' => 'int32', - '_30_x' => 'int32', - '_40_x' => 'int32', - 'end_timestamp' => 'int64', - '_50_x' => 'int32', - 'start_timestamp' => 'int64', - 'end_datetime' => null, - 'avg_origin_response_time' => 'int32' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - '_403' => false, - '_404' => false, - '_500' => false, - '_504' => false, - 'start_datetime' => false, - 'response_time_ms' => false, - '_95th' => false, - 'total_requests' => false, - 'cache_hit_rate' => false, - '_99th' => false, - 'total_request_time' => false, - '_100_x' => false, - '_50th' => false, - 'cache_hits' => false, - '_20_x' => false, - '_30_x' => false, - '_40_x' => false, - 'end_timestamp' => false, - '_50_x' => false, - 'start_timestamp' => false, - 'end_datetime' => false, - 'avg_origin_response_time' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - '_403' => '403', - '_404' => '404', - '_500' => '500', - '_504' => '504', - 'start_datetime' => 'startDatetime', - 'response_time_ms' => 'responseTimeMs', - '_95th' => '95th', - 'total_requests' => 'totalRequests', - 'cache_hit_rate' => 'cacheHitRate', - '_99th' => '99th', - 'total_request_time' => 'totalRequestTime', - '_100_x' => '100X', - '_50th' => '50th', - 'cache_hits' => 'cacheHits', - '_20_x' => '20X', - '_30_x' => '30X', - '_40_x' => '40X', - 'end_timestamp' => 'endTimestamp', - '_50_x' => '50X', - 'start_timestamp' => 'startTimestamp', - 'end_datetime' => 'endDatetime', - 'avg_origin_response_time' => 'avgOriginResponseTime' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - '_403' => 'set403', - '_404' => 'set404', - '_500' => 'set500', - '_504' => 'set504', - 'start_datetime' => 'setStartDatetime', - 'response_time_ms' => 'setResponseTimeMs', - '_95th' => 'set95th', - 'total_requests' => 'setTotalRequests', - 'cache_hit_rate' => 'setCacheHitRate', - '_99th' => 'set99th', - 'total_request_time' => 'setTotalRequestTime', - '_100_x' => 'set100X', - '_50th' => 'set50th', - 'cache_hits' => 'setCacheHits', - '_20_x' => 'set20X', - '_30_x' => 'set30X', - '_40_x' => 'set40X', - 'end_timestamp' => 'setEndTimestamp', - '_50_x' => 'set50X', - 'start_timestamp' => 'setStartTimestamp', - 'end_datetime' => 'setEndDatetime', - 'avg_origin_response_time' => 'setAvgOriginResponseTime' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - '_403' => 'get403', - '_404' => 'get404', - '_500' => 'get500', - '_504' => 'get504', - 'start_datetime' => 'getStartDatetime', - 'response_time_ms' => 'getResponseTimeMs', - '_95th' => 'get95th', - 'total_requests' => 'getTotalRequests', - 'cache_hit_rate' => 'getCacheHitRate', - '_99th' => 'get99th', - 'total_request_time' => 'getTotalRequestTime', - '_100_x' => 'get100X', - '_50th' => 'get50th', - 'cache_hits' => 'getCacheHits', - '_20_x' => 'get20X', - '_30_x' => 'get30X', - '_40_x' => 'get40X', - 'end_timestamp' => 'getEndTimestamp', - '_50_x' => 'get50X', - 'start_timestamp' => 'getStartTimestamp', - 'end_datetime' => 'getEndDatetime', - 'avg_origin_response_time' => 'getAvgOriginResponseTime' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('_403', $data ?? [], null); - $this->setIfExists('_404', $data ?? [], null); - $this->setIfExists('_500', $data ?? [], null); - $this->setIfExists('_504', $data ?? [], null); - $this->setIfExists('start_datetime', $data ?? [], null); - $this->setIfExists('response_time_ms', $data ?? [], null); - $this->setIfExists('_95th', $data ?? [], null); - $this->setIfExists('total_requests', $data ?? [], null); - $this->setIfExists('cache_hit_rate', $data ?? [], null); - $this->setIfExists('_99th', $data ?? [], null); - $this->setIfExists('total_request_time', $data ?? [], null); - $this->setIfExists('_100_x', $data ?? [], null); - $this->setIfExists('_50th', $data ?? [], null); - $this->setIfExists('cache_hits', $data ?? [], null); - $this->setIfExists('_20_x', $data ?? [], null); - $this->setIfExists('_30_x', $data ?? [], null); - $this->setIfExists('_40_x', $data ?? [], null); - $this->setIfExists('end_timestamp', $data ?? [], null); - $this->setIfExists('_50_x', $data ?? [], null); - $this->setIfExists('start_timestamp', $data ?? [], null); - $this->setIfExists('end_datetime', $data ?? [], null); - $this->setIfExists('avg_origin_response_time', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['_403'] === null) { - $invalidProperties[] = "'_403' can't be null"; - } - if ($this->container['_404'] === null) { - $invalidProperties[] = "'_404' can't be null"; - } - if ($this->container['_500'] === null) { - $invalidProperties[] = "'_500' can't be null"; - } - if ($this->container['_504'] === null) { - $invalidProperties[] = "'_504' can't be null"; - } - if ($this->container['response_time_ms'] === null) { - $invalidProperties[] = "'response_time_ms' can't be null"; - } - if ($this->container['_95th'] === null) { - $invalidProperties[] = "'_95th' can't be null"; - } - if ($this->container['total_requests'] === null) { - $invalidProperties[] = "'total_requests' can't be null"; - } - if ($this->container['cache_hit_rate'] === null) { - $invalidProperties[] = "'cache_hit_rate' can't be null"; - } - if ($this->container['_99th'] === null) { - $invalidProperties[] = "'_99th' can't be null"; - } - if ($this->container['_100_x'] === null) { - $invalidProperties[] = "'_100_x' can't be null"; - } - if ($this->container['_50th'] === null) { - $invalidProperties[] = "'_50th' can't be null"; - } - if ($this->container['cache_hits'] === null) { - $invalidProperties[] = "'cache_hits' can't be null"; - } - if ($this->container['_20_x'] === null) { - $invalidProperties[] = "'_20_x' can't be null"; - } - if ($this->container['_30_x'] === null) { - $invalidProperties[] = "'_30_x' can't be null"; - } - if ($this->container['_40_x'] === null) { - $invalidProperties[] = "'_40_x' can't be null"; - } - if ($this->container['end_timestamp'] === null) { - $invalidProperties[] = "'end_timestamp' can't be null"; - } - if ($this->container['_50_x'] === null) { - $invalidProperties[] = "'_50_x' can't be null"; - } - if ($this->container['start_timestamp'] === null) { - $invalidProperties[] = "'start_timestamp' can't be null"; - } - if ($this->container['avg_origin_response_time'] === null) { - $invalidProperties[] = "'avg_origin_response_time' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets _403 - * - * @return int - */ - public function get403() - { - return $this->container['_403']; - } - - /** - * Sets _403 - * - * @param int $_403 The number of responses that had an http status code of 403. - * - * @return self - */ - public function set403($_403) - { - if (is_null($_403)) { - throw new \InvalidArgumentException('non-nullable _403 cannot be null'); - } - $this->container['_403'] = $_403; - - return $this; - } - - /** - * Gets _404 - * - * @return int - */ - public function get404() - { - return $this->container['_404']; - } - - /** - * Sets _404 - * - * @param int $_404 The number of responses that had an http status code of 404. - * - * @return self - */ - public function set404($_404) - { - if (is_null($_404)) { - throw new \InvalidArgumentException('non-nullable _404 cannot be null'); - } - $this->container['_404'] = $_404; - - return $this; - } - - /** - * Gets _500 - * - * @return int - */ - public function get500() - { - return $this->container['_500']; - } - - /** - * Sets _500 - * - * @param int $_500 The number of responses that had an http status code of 500. - * - * @return self - */ - public function set500($_500) - { - if (is_null($_500)) { - throw new \InvalidArgumentException('non-nullable _500 cannot be null'); - } - $this->container['_500'] = $_500; - - return $this; - } - - /** - * Gets _504 - * - * @return int - */ - public function get504() - { - return $this->container['_504']; - } - - /** - * Sets _504 - * - * @param int $_504 The number of responses that had an http status code of 504. - * - * @return self - */ - public function set504($_504) - { - if (is_null($_504)) { - throw new \InvalidArgumentException('non-nullable _504 cannot be null'); - } - $this->container['_504'] = $_504; - - return $this; - } - - /** - * Gets start_datetime - * - * @return string|null - */ - public function getStartDatetime() - { - return $this->container['start_datetime']; - } - - /** - * Sets start_datetime - * - * @param string|null $start_datetime start_datetime - * - * @return self - */ - public function setStartDatetime($start_datetime) - { - if (is_null($start_datetime)) { - throw new \InvalidArgumentException('non-nullable start_datetime cannot be null'); - } - $this->container['start_datetime'] = $start_datetime; - - return $this; - } - - /** - * Gets response_time_ms - * - * @return int - */ - public function getResponseTimeMs() - { - return $this->container['response_time_ms']; - } - - /** - * Sets response_time_ms - * - * @param int $response_time_ms The average response time in milliseconds. - * - * @return self - */ - public function setResponseTimeMs($response_time_ms) - { - if (is_null($response_time_ms)) { - throw new \InvalidArgumentException('non-nullable response_time_ms cannot be null'); - } - $this->container['response_time_ms'] = $response_time_ms; - - return $this; - } - - /** - * Gets _95th - * - * @return int - */ - public function get95th() - { - return $this->container['_95th']; - } - - /** - * Sets _95th - * - * @param int $_95th The 95th percentile response time. - * - * @return self - */ - public function set95th($_95th) - { - if (is_null($_95th)) { - throw new \InvalidArgumentException('non-nullable _95th cannot be null'); - } - $this->container['_95th'] = $_95th; - - return $this; - } - - /** - * Gets total_requests - * - * @return int - */ - public function getTotalRequests() - { - return $this->container['total_requests']; - } - - /** - * Sets total_requests - * - * @param int $total_requests The total number of requests received in this period. - * - * @return self - */ - public function setTotalRequests($total_requests) - { - if (is_null($total_requests)) { - throw new \InvalidArgumentException('non-nullable total_requests cannot be null'); - } - $this->container['total_requests'] = $total_requests; - - return $this; - } - - /** - * Gets cache_hit_rate - * - * @return float - */ - public function getCacheHitRate() - { - return $this->container['cache_hit_rate']; - } - - /** - * Sets cache_hit_rate - * - * @param float $cache_hit_rate The percentage of requests that were served cached responses. - * - * @return self - */ - public function setCacheHitRate($cache_hit_rate) - { - if (is_null($cache_hit_rate)) { - throw new \InvalidArgumentException('non-nullable cache_hit_rate cannot be null'); - } - $this->container['cache_hit_rate'] = $cache_hit_rate; - - return $this; - } - - /** - * Gets _99th - * - * @return int - */ - public function get99th() - { - return $this->container['_99th']; - } - - /** - * Sets _99th - * - * @param int $_99th The 99th percentile response time. - * - * @return self - */ - public function set99th($_99th) - { - if (is_null($_99th)) { - throw new \InvalidArgumentException('non-nullable _99th cannot be null'); - } - $this->container['_99th'] = $_99th; - - return $this; - } - - /** - * Gets total_request_time - * - * @return int|null - */ - public function getTotalRequestTime() - { - return $this->container['total_request_time']; - } - - /** - * Sets total_request_time - * - * @param int|null $total_request_time total_request_time - * - * @return self - */ - public function setTotalRequestTime($total_request_time) - { - if (is_null($total_request_time)) { - throw new \InvalidArgumentException('non-nullable total_request_time cannot be null'); - } - $this->container['total_request_time'] = $total_request_time; - - return $this; - } - - /** - * Gets _100_x - * - * @return int - */ - public function get100X() - { - return $this->container['_100_x']; - } - - /** - * Sets _100_x - * - * @param int $_100_x The number of responses that had an http status code between 1000-1999. - * - * @return self - */ - public function set100X($_100_x) - { - if (is_null($_100_x)) { - throw new \InvalidArgumentException('non-nullable _100_x cannot be null'); - } - $this->container['_100_x'] = $_100_x; - - return $this; - } - - /** - * Gets _50th - * - * @return int - */ - public function get50th() - { - return $this->container['_50th']; - } - - /** - * Sets _50th - * - * @param int $_50th The 50th percentile response time. - * - * @return self - */ - public function set50th($_50th) - { - if (is_null($_50th)) { - throw new \InvalidArgumentException('non-nullable _50th cannot be null'); - } - $this->container['_50th'] = $_50th; - - return $this; - } - - /** - * Gets cache_hits - * - * @return int - */ - public function getCacheHits() - { - return $this->container['cache_hits']; - } - - /** - * Sets cache_hits - * - * @param int $cache_hits The total number of requests that were served cached responses. - * - * @return self - */ - public function setCacheHits($cache_hits) - { - if (is_null($cache_hits)) { - throw new \InvalidArgumentException('non-nullable cache_hits cannot be null'); - } - $this->container['cache_hits'] = $cache_hits; - - return $this; - } - - /** - * Gets _20_x - * - * @return int - */ - public function get20X() - { - return $this->container['_20_x']; - } - - /** - * Sets _20_x - * - * @param int $_20_x The number of responses that had an http status code between 200-299. - * - * @return self - */ - public function set20X($_20_x) - { - if (is_null($_20_x)) { - throw new \InvalidArgumentException('non-nullable _20_x cannot be null'); - } - $this->container['_20_x'] = $_20_x; - - return $this; - } - - /** - * Gets _30_x - * - * @return int - */ - public function get30X() - { - return $this->container['_30_x']; - } - - /** - * Sets _30_x - * - * @param int $_30_x The number of responses that had an http status code between 300-399. - * - * @return self - */ - public function set30X($_30_x) - { - if (is_null($_30_x)) { - throw new \InvalidArgumentException('non-nullable _30_x cannot be null'); - } - $this->container['_30_x'] = $_30_x; - - return $this; - } - - /** - * Gets _40_x - * - * @return int - */ - public function get40X() - { - return $this->container['_40_x']; - } - - /** - * Sets _40_x - * - * @param int $_40_x The number of responses that had an http status code between 400-499. - * - * @return self - */ - public function set40X($_40_x) - { - if (is_null($_40_x)) { - throw new \InvalidArgumentException('non-nullable _40_x cannot be null'); - } - $this->container['_40_x'] = $_40_x; - - return $this; - } - - /** - * Gets end_timestamp - * - * @return int - */ - public function getEndTimestamp() - { - return $this->container['end_timestamp']; - } - - /** - * Sets end_timestamp - * - * @param int $end_timestamp The timestamp in milliseconds of the end of this interval. - * - * @return self - */ - public function setEndTimestamp($end_timestamp) - { - if (is_null($end_timestamp)) { - throw new \InvalidArgumentException('non-nullable end_timestamp cannot be null'); - } - $this->container['end_timestamp'] = $end_timestamp; - - return $this; - } - - /** - * Gets _50_x - * - * @return int - */ - public function get50X() - { - return $this->container['_50_x']; - } - - /** - * Sets _50_x - * - * @param int $_50_x The number of responses that had an http status code between 500-599. - * - * @return self - */ - public function set50X($_50_x) - { - if (is_null($_50_x)) { - throw new \InvalidArgumentException('non-nullable _50_x cannot be null'); - } - $this->container['_50_x'] = $_50_x; - - return $this; - } - - /** - * Gets start_timestamp - * - * @return int - */ - public function getStartTimestamp() - { - return $this->container['start_timestamp']; - } - - /** - * Sets start_timestamp - * - * @param int $start_timestamp The timestamp in milliseconds of the start of this interval. - * - * @return self - */ - public function setStartTimestamp($start_timestamp) - { - if (is_null($start_timestamp)) { - throw new \InvalidArgumentException('non-nullable start_timestamp cannot be null'); - } - $this->container['start_timestamp'] = $start_timestamp; - - return $this; - } - - /** - * Gets end_datetime - * - * @return string|null - */ - public function getEndDatetime() - { - return $this->container['end_datetime']; - } - - /** - * Sets end_datetime - * - * @param string|null $end_datetime end_datetime - * - * @return self - */ - public function setEndDatetime($end_datetime) - { - if (is_null($end_datetime)) { - throw new \InvalidArgumentException('non-nullable end_datetime cannot be null'); - } - $this->container['end_datetime'] = $end_datetime; - - return $this; - } - - /** - * Gets avg_origin_response_time - * - * @return int - */ - public function getAvgOriginResponseTime() - { - return $this->container['avg_origin_response_time']; - } - - /** - * Sets avg_origin_response_time - * - * @param int $avg_origin_response_time The average response time in milliseconds from the origin to the edge. - * - * @return self - */ - public function setAvgOriginResponseTime($avg_origin_response_time) - { - if (is_null($avg_origin_response_time)) { - throw new \InvalidArgumentException('non-nullable avg_origin_response_time cannot be null'); - } - $this->container['avg_origin_response_time'] = $avg_origin_response_time; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/codegen/Cms/Performance/ObjectSerializer.php b/codegen/Cms/Performance/ObjectSerializer.php deleted file mode 100644 index b3a77a6ef..000000000 --- a/codegen/Cms/Performance/ObjectSerializer.php +++ /dev/null @@ -1,567 +0,0 @@ -format('Y-m-d') : $data->format(self::$dateTimeFormat); - } - - if (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = self::sanitizeForSerialization($value); - } - return $data; - } - - if (is_object($data)) { - $values = []; - if ($data instanceof ModelInterface) { - $formats = $data::openAPIFormats(); - foreach ($data::openAPITypes() as $property => $openAPIType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - $callable = [$openAPIType, 'getAllowableEnumValues']; - if (is_callable($callable)) { - /** array $callable */ - $allowedEnumTypes = $callable(); - if (!in_array($value, $allowedEnumTypes, true)) { - $imploded = implode("', '", $allowedEnumTypes); - throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); - } - } - } - if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); - } - } - } else { - foreach($data as $property => $value) { - $values[$property] = self::sanitizeForSerialization($value); - } - } - return (object)$values; - } else { - return (string)$data; - } - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param string $filename filename to be sanitized - * - * @return string the sanitized filename - */ - public static function sanitizeFilename($filename) - { - if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { - return $match[1]; - } else { - return $filename; - } - } - - /** - * Shorter timestamp microseconds to 6 digits length. - * - * @param string $timestamp Original timestamp - * - * @return string the shorten timestamp - */ - public static function sanitizeTimestamp($timestamp) - { - if (!is_string($timestamp)) return $timestamp; - - return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * - * @param string $value a string which will be part of the path - * - * @return string the serialized object - */ - public static function toPathValue($value) - { - return rawurlencode(self::toString($value)); - } - - /** - * Checks if a value is empty, based on its OpenAPI type. - * - * @param mixed $value - * @param string $openApiType - * - * @return bool true if $value is empty - */ - private static function isEmptyValue($value, string $openApiType): bool - { - # If empty() returns false, it is not empty regardless of its type. - if (!empty($value)) { - return false; - } - - # Null is always empty, as we cannot send a real "null" value in a query parameter. - if ($value === null) { - return true; - } - - switch ($openApiType) { - # For numeric values, false and '' are considered empty. - # This comparison is safe for floating point values, since the previous call to empty() will - # filter out values that don't match 0. - case 'int': - case 'integer': - return $value !== 0; - - case 'number': - case 'float': - return $value !== 0 && $value !== 0.0; - - # For boolean values, '' is considered empty - case 'bool': - case 'boolean': - return !in_array($value, [false, 0], true); - - # For all the other types, any value at this point can be considered empty. - default: - return true; - } - } - - /** - * Take query parameter properties and turn it into an array suitable for - * native http_build_query or GuzzleHttp\Psr7\Query::build. - * - * @param mixed $value Parameter value - * @param string $paramName Parameter name - * @param string $openApiType OpenAPIType eg. array or object - * @param string $style Parameter serialization style - * @param bool $explode Parameter explode option - * @param bool $required Whether query param is required or not - * - * @return array - */ - public static function toQueryValue( - $value, - string $paramName, - string $openApiType = 'string', - string $style = 'form', - bool $explode = true, - bool $required = true - ): array { - - # Check if we should omit this parameter from the query. This should only happen when: - # - Parameter is NOT required; AND - # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For - # example, 0 as "int" or "boolean" is NOT an empty value. - if (self::isEmptyValue($value, $openApiType)) { - if ($required) { - return ["{$paramName}" => '']; - } else { - return []; - } - } - - # Handle DateTime objects in query - if($openApiType === "\\DateTime" && $value instanceof \DateTime) { - return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; - } - - $query = []; - $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; - - // since \GuzzleHttp\Psr7\Query::build fails with nested arrays - // need to flatten array first - $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { - if (!is_array($arr)) return $arr; - - foreach ($arr as $k => $v) { - $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; - - if (is_array($v)) { - $flattenArray($v, $prop, $result); - } else { - if ($style !== 'deepObject' && !$explode) { - // push key itself - $result[] = $prop; - } - $result[$prop] = $v; - } - } - return $result; - }; - - $value = $flattenArray($value, $paramName); - - if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { - return $value; - } - - if ('boolean' === $openApiType && is_bool($value)) { - $value = self::convertBoolToQueryStringFormat($value); - } - - // handle style in serializeCollection - $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); - - return $query; - } - - /** - * Convert boolean value to format for query string. - * - * @param bool $value Boolean value - * - * @return int|string Boolean value in format - */ - public static function convertBoolToQueryStringFormat(bool $value) - { - if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { - return $value ? 'true' : 'false'; - } - - return (int) $value; - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string $value a string which will be part of the header - * - * @return string the header string - */ - public static function toHeaderValue($value) - { - $callable = [$value, 'toHeaderValue']; - if (is_callable($callable)) { - return $callable(); - } - - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * If it's a boolean, convert it to "true" or "false". - * - * @param string|bool|\DateTime $value the value of the parameter - * - * @return string the header string - */ - public static function toString($value) - { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(self::$dateTimeFormat); - } elseif (is_bool($value)) { - return $value ? 'true' : 'false'; - } else { - return (string) $value; - } - } - - /** - * Serialize an array to a string. - * - * @param array $collection collection to serialize to a string - * @param string $style the format use for serialization (csv, - * ssv, tsv, pipes, multi) - * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array - * - * @return string - */ - public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) - { - if ($allowCollectionFormatMulti && ('multi' === $style)) { - // http_build_query() almost does the job for us. We just - // need to fix the result of multidimensional arrays. - return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); - } - switch ($style) { - case 'pipeDelimited': - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'spaceDelimited': - case 'ssv': - return implode(' ', $collection); - - case 'simple': - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } - } - - /** - * Deserialize a JSON string into an object - * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used - * - * @return object|array|null a single or an array of $class instances - */ - public static function deserialize($data, $class, $httpHeaders = null) - { - if (null === $data) { - return null; - } - - if (strcasecmp(substr($class, -2), '[]') === 0) { - $data = is_string($data) ? json_decode($data) : $data; - - if (!is_array($data)) { - throw new \InvalidArgumentException("Invalid array '$class'"); - } - - $subClass = substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - return $values; - } - - if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array - $data = is_string($data) ? json_decode($data) : $data; - settype($data, 'array'); - $inner = substr($class, 4, -1); - $deserialized = []; - if (strrpos($inner, ",") !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $deserialized[$key] = self::deserialize($value, $subClass, null); - } - } - return $deserialized; - } - - if ($class === 'object') { - settype($data, 'array'); - return $data; - } elseif ($class === 'mixed') { - settype($data, gettype($data)); - return $data; - } - - if ($class === '\DateTime') { - // Some APIs return an invalid, empty string as a - // date-time property. DateTime::__construct() will return - // the current time for empty input which is probably not - // what is meant. The invalid empty string is probably to - // be interpreted as a missing field/value. Let's handle - // this graceful. - if (!empty($data)) { - try { - return new \DateTime($data); - } catch (\Exception $exception) { - // Some APIs return a date-time with too high nanosecond - // precision for php's DateTime to handle. - // With provided regexp 6 digits of microseconds saved - return new \DateTime(self::sanitizeTimestamp($data)); - } - } else { - return null; - } - } - - if ($class === '\SplFileObject') { - $data = Utils::streamFor($data); - - /** @var \Psr\Http\Message\StreamInterface $data */ - - // determine file name - if ( - is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) - && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) - ) { - $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); - } else { - $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); - } - - $file = fopen($filename, 'w'); - while ($chunk = $data->read(200)) { - fwrite($file, $chunk); - } - fclose($file); - - return new \SplFileObject($filename, 'r'); - } - - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } - - - if (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $class::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); - } - return $data; - } else { - $data = is_string($data) ? json_decode($data) : $data; - - if (is_array($data)) { - $data = (object)$data; - } - - // If a discriminator is defined and points to a valid subclass, use it. - $discriminator = $class::DISCRIMINATOR; - if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { - $subclass = '\HubSpot\Client\Cms\Performance\Model\\' . $data->{$discriminator}; - if (is_subclass_of($subclass, $class)) { - $class = $subclass; - } - } - - /** @var ModelInterface $instance */ - $instance = new $class(); - foreach ($instance::openAPITypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; - - if (!isset($propertySetter)) { - continue; - } - - if (!isset($data->{$instance::attributeMap()[$property]})) { - if ($instance::isNullable($property)) { - $instance->$propertySetter(null); - } - - continue; - } - - if (isset($data->{$instance::attributeMap()[$property]})) { - $propertyValue = $data->{$instance::attributeMap()[$property]}; - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); - } - } - return $instance; - } - } - - /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); - } -} diff --git a/codegen/Cms/SiteSearch/Api/PublicApi.php b/codegen/Cms/SiteSearch/Api/PublicApi.php index 9a4785bb1..207f7b796 100644 --- a/codegen/Cms/SiteSearch/Api/PublicApi.php +++ b/codegen/Cms/SiteSearch/Api/PublicApi.php @@ -10,13 +10,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class PublicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -131,7 +131,7 @@ public function getConfig() * Get indexed properties. * * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @param string $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) + * @param string|null $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SiteSearch\ApiException on non-2xx response or if the response body is not in the expected format @@ -150,7 +150,7 @@ public function getById($content_id, $type = null, string $contentType = self::c * Get indexed properties. * * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @param string $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) + * @param string|null $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SiteSearch\ApiException on non-2xx response or if the response body is not in the expected format @@ -183,18 +183,6 @@ public function getByIdWithHttpInfo($content_id, $type = null, string $contentTy $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -253,6 +241,19 @@ public function getByIdWithHttpInfo($content_id, $type = null, string $contentTy ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SiteSearch\Model\IndexedData'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -310,7 +311,7 @@ public function getByIdWithHttpInfo($content_id, $type = null, string $contentTy * Get indexed properties. * * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @param string $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) + * @param string|null $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -332,7 +333,7 @@ function ($response) { * Get indexed properties. * * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @param string $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) + * @param string|null $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -383,7 +384,7 @@ function ($exception) { * Create request for operation 'getById' * * @param string $content_id ID of the target document when searching for indexed properties. (required) - * @param string $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) + * @param string|null $type The type of document. Can be one of `SITE_PAGE`, `BLOG_POST`, or `KNOWLEDGE_ARTICLE`. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -494,23 +495,23 @@ public function getByIdRequest($content_id, $type = null, string $contentType = * * Search your site. * - * @param string $q The term to search for. (optional) - * @param int $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) - * @param int $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) - * @param string $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) - * @param bool $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) - * @param bool $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) - * @param float $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) - * @param float $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) - * @param string $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) - * @param int $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) - * @param string $hubdb_query Specify a HubDB query to further filter the search results. (optional) - * @param string[] $domain A domain to match search results for. Multiple domains can be provided with &. (optional) - * @param string[] $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) - * @param string[] $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) - * @param string[] $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) - * @param string $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) - * @param int[] $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) + * @param string|null $q The term to search for. (optional) + * @param int|null $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) + * @param int|null $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) + * @param string|null $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) + * @param bool|null $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) + * @param bool|null $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) + * @param float|null $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) + * @param float|null $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) + * @param string|null $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) + * @param int|null $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) + * @param string|null $hubdb_query Specify a HubDB query to further filter the search results. (optional) + * @param string[]|null $domain A domain to match search results for. Multiple domains can be provided with &. (optional) + * @param string[]|null $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) + * @param string[]|null $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) + * @param string[]|null $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) + * @param string|null $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) + * @param int[]|null $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['search'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SiteSearch\ApiException on non-2xx response or if the response body is not in the expected format @@ -528,23 +529,23 @@ public function search($q = null, $limit = null, $offset = null, $language = nul * * Search your site. * - * @param string $q The term to search for. (optional) - * @param int $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) - * @param int $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) - * @param string $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) - * @param bool $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) - * @param bool $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) - * @param float $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) - * @param float $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) - * @param string $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) - * @param int $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) - * @param string $hubdb_query Specify a HubDB query to further filter the search results. (optional) - * @param string[] $domain A domain to match search results for. Multiple domains can be provided with &. (optional) - * @param string[] $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) - * @param string[] $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) - * @param string[] $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) - * @param string $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) - * @param int[] $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) + * @param string|null $q The term to search for. (optional) + * @param int|null $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) + * @param int|null $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) + * @param string|null $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) + * @param bool|null $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) + * @param bool|null $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) + * @param float|null $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) + * @param float|null $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) + * @param string|null $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) + * @param int|null $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) + * @param string|null $hubdb_query Specify a HubDB query to further filter the search results. (optional) + * @param string[]|null $domain A domain to match search results for. Multiple domains can be provided with &. (optional) + * @param string[]|null $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) + * @param string[]|null $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) + * @param string[]|null $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) + * @param string|null $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) + * @param int[]|null $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['search'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SiteSearch\ApiException on non-2xx response or if the response body is not in the expected format @@ -577,18 +578,6 @@ public function searchWithHttpInfo($q = null, $limit = null, $offset = null, $la $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -647,6 +636,19 @@ public function searchWithHttpInfo($q = null, $limit = null, $offset = null, $la ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SiteSearch\Model\PublicSearchResults'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -703,23 +705,23 @@ public function searchWithHttpInfo($q = null, $limit = null, $offset = null, $la * * Search your site. * - * @param string $q The term to search for. (optional) - * @param int $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) - * @param int $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) - * @param string $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) - * @param bool $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) - * @param bool $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) - * @param float $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) - * @param float $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) - * @param string $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) - * @param int $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) - * @param string $hubdb_query Specify a HubDB query to further filter the search results. (optional) - * @param string[] $domain A domain to match search results for. Multiple domains can be provided with &. (optional) - * @param string[] $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) - * @param string[] $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) - * @param string[] $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) - * @param string $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) - * @param int[] $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) + * @param string|null $q The term to search for. (optional) + * @param int|null $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) + * @param int|null $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) + * @param string|null $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) + * @param bool|null $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) + * @param bool|null $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) + * @param float|null $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) + * @param float|null $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) + * @param string|null $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) + * @param int|null $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) + * @param string|null $hubdb_query Specify a HubDB query to further filter the search results. (optional) + * @param string[]|null $domain A domain to match search results for. Multiple domains can be provided with &. (optional) + * @param string[]|null $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) + * @param string[]|null $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) + * @param string[]|null $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) + * @param string|null $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) + * @param int[]|null $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['search'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -740,23 +742,23 @@ function ($response) { * * Search your site. * - * @param string $q The term to search for. (optional) - * @param int $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) - * @param int $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) - * @param string $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) - * @param bool $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) - * @param bool $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) - * @param float $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) - * @param float $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) - * @param string $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) - * @param int $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) - * @param string $hubdb_query Specify a HubDB query to further filter the search results. (optional) - * @param string[] $domain A domain to match search results for. Multiple domains can be provided with &. (optional) - * @param string[] $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) - * @param string[] $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) - * @param string[] $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) - * @param string $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) - * @param int[] $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) + * @param string|null $q The term to search for. (optional) + * @param int|null $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) + * @param int|null $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) + * @param string|null $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) + * @param bool|null $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) + * @param bool|null $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) + * @param float|null $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) + * @param float|null $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) + * @param string|null $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) + * @param int|null $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) + * @param string|null $hubdb_query Specify a HubDB query to further filter the search results. (optional) + * @param string[]|null $domain A domain to match search results for. Multiple domains can be provided with &. (optional) + * @param string[]|null $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) + * @param string[]|null $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) + * @param string[]|null $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) + * @param string|null $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) + * @param int[]|null $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['search'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -806,23 +808,23 @@ function ($exception) { /** * Create request for operation 'search' * - * @param string $q The term to search for. (optional) - * @param int $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) - * @param int $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) - * @param string $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) - * @param bool $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) - * @param bool $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) - * @param float $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) - * @param float $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) - * @param string $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) - * @param int $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) - * @param string $hubdb_query Specify a HubDB query to further filter the search results. (optional) - * @param string[] $domain A domain to match search results for. Multiple domains can be provided with &. (optional) - * @param string[] $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) - * @param string[] $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) - * @param string[] $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) - * @param string $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) - * @param int[] $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) + * @param string|null $q The term to search for. (optional) + * @param int|null $limit Specifies the number of results to be returned in a single response. Defaults to `10`. Maximum value is `100`. (optional) + * @param int|null $offset Used to page through the results. If there are more results than specified by the `limit` parameter, you will need to use the value of offset returned in the previous request to get the next set of results. (optional) + * @param string|null $language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `es` for Spanish) (optional) + * @param bool|null $match_prefix Inverts the behavior of the pathPrefix filter when set to `false`. Defaults to `true`. (optional) + * @param bool|null $autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. (optional) + * @param float|null $popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. (optional) + * @param float|null $boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). (optional) + * @param string|null $boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent=10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). (optional) + * @param int|null $table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the `hubdbQuery` parameter to further filter results. (optional) + * @param string|null $hubdb_query Specify a HubDB query to further filter the search results. (optional) + * @param string[]|null $domain A domain to match search results for. Multiple domains can be provided with &. (optional) + * @param string[]|null $type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE (optional) + * @param string[]|null $path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. (optional) + * @param string[]|null $property Specifies which properties to include in the search. Options include `title`, `description`, and `html`. All properties will be searched by default. (optional) + * @param string|null $length Specifies the length of the search results. Can be set to `LONG` or `SHORT`. `SHORT` will return the first 128 characters of the content's meta description. `LONG` will build a more detailed content snippet based on the html/content of the page. (optional) + * @param int[]|null $group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['search'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Cms/SiteSearch/ApiException.php b/codegen/Cms/SiteSearch/ApiException.php index 799560f5c..5110a8fe9 100644 --- a/codegen/Cms/SiteSearch/ApiException.php +++ b/codegen/Cms/SiteSearch/ApiException.php @@ -10,13 +10,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/SiteSearch/Configuration.php b/codegen/Cms/SiteSearch/Configuration.php index e0315b669..95594c7dc 100644 --- a/codegen/Cms/SiteSearch/Configuration.php +++ b/codegen/Cms/SiteSearch/Configuration.php @@ -10,13 +10,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/SiteSearch/HeaderSelector.php b/codegen/Cms/SiteSearch/HeaderSelector.php index b3992fdb2..1218bd9a1 100644 --- a/codegen/Cms/SiteSearch/HeaderSelector.php +++ b/codegen/Cms/SiteSearch/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/SiteSearch/Model/ContentSearchResult.php b/codegen/Cms/SiteSearch/Model/ContentSearchResult.php index 71f7e2955..f19c34af8 100644 --- a/codegen/Cms/SiteSearch/Model/ContentSearchResult.php +++ b/codegen/Cms/SiteSearch/Model/ContentSearchResult.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -1876,10 +1876,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('combined_id', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); diff --git a/codegen/Cms/SiteSearch/Model/Error.php b/codegen/Cms/SiteSearch/Model/Error.php index 8dce9382a..07b94af28 100644 --- a/codegen/Cms/SiteSearch/Model/Error.php +++ b/codegen/Cms/SiteSearch/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/SiteSearch/Model/ErrorDetail.php b/codegen/Cms/SiteSearch/Model/ErrorDetail.php index 7837cfaba..f6e5109b6 100644 --- a/codegen/Cms/SiteSearch/Model/ErrorDetail.php +++ b/codegen/Cms/SiteSearch/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/SiteSearch/Model/IndexedData.php b/codegen/Cms/SiteSearch/Model/IndexedData.php index d4190a0a8..221f957a2 100644 --- a/codegen/Cms/SiteSearch/Model/IndexedData.php +++ b/codegen/Cms/SiteSearch/Model/IndexedData.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -273,10 +273,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Cms/SiteSearch/Model/IndexedField.php b/codegen/Cms/SiteSearch/Model/IndexedField.php index ba32081c1..322feda99 100644 --- a/codegen/Cms/SiteSearch/Model/IndexedField.php +++ b/codegen/Cms/SiteSearch/Model/IndexedField.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('values', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Cms/SiteSearch/Model/ModelInterface.php b/codegen/Cms/SiteSearch/Model/ModelInterface.php index 0d09b1276..c0ddc1fc9 100644 --- a/codegen/Cms/SiteSearch/Model/ModelInterface.php +++ b/codegen/Cms/SiteSearch/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/SiteSearch/Model/PublicSearchResults.php b/codegen/Cms/SiteSearch/Model/PublicSearchResults.php index 0b5959a7f..2d856ebb2 100644 --- a/codegen/Cms/SiteSearch/Model/PublicSearchResults.php +++ b/codegen/Cms/SiteSearch/Model/PublicSearchResults.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('search_term', $data ?? [], null); diff --git a/codegen/Cms/SiteSearch/ObjectSerializer.php b/codegen/Cms/SiteSearch/ObjectSerializer.php index 5ecf36be9..5b9742b12 100644 --- a/codegen/Cms/SiteSearch/ObjectSerializer.php +++ b/codegen/Cms/SiteSearch/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * CMS Site Search + * Site Search * * Use these endpoints for searching content on your HubSpot hosted CMS website(s). * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/SourceCode/Api/ContentApi.php b/codegen/Cms/SourceCode/Api/ContentApi.php index 356a5b5d2..f4e02c725 100644 --- a/codegen/Cms/SourceCode/Api/ContentApi.php +++ b/codegen/Cms/SourceCode/Api/ContentApi.php @@ -10,13 +10,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -92,13 +92,13 @@ class ContentApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -188,18 +188,6 @@ public function archiveWithHttpInfo($environment, $path, string $contentType = s $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -402,7 +390,7 @@ public function archiveRequest($environment, $path, string $contentType = self:: * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file file (optional) + * @param \SplFileObject|null $file file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -423,7 +411,7 @@ public function create($environment, $path, $file = null, string $contentType = * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -457,18 +445,6 @@ public function createWithHttpInfo($environment, $path, $file = null, string $co $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -527,6 +503,19 @@ public function createWithHttpInfo($environment, $path, $file = null, string $co ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -585,7 +574,7 @@ public function createWithHttpInfo($environment, $path, $file = null, string $co * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -609,7 +598,7 @@ function ($response) { * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -662,7 +651,7 @@ function ($exception) { * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -730,6 +719,7 @@ public function createRequest($environment, $path, $file = null, string $content } } + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*', ], $contentType, @@ -794,7 +784,7 @@ public function createRequest($environment, $path, $file = null, string $content * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file file (optional) + * @param \SplFileObject|null $file file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrUpdate'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -814,7 +804,7 @@ public function createOrUpdate($environment, $path, $file = null, string $conten * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrUpdate'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -847,18 +837,6 @@ public function createOrUpdateWithHttpInfo($environment, $path, $file = null, st $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -917,6 +895,19 @@ public function createOrUpdateWithHttpInfo($environment, $path, $file = null, st ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -975,7 +966,7 @@ public function createOrUpdateWithHttpInfo($environment, $path, $file = null, st * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrUpdate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -998,7 +989,7 @@ function ($response) { * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrUpdate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1050,7 +1041,7 @@ function ($exception) { * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrUpdate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1117,6 +1108,7 @@ public function createOrUpdateRequest($environment, $path, $file = null, string } } + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*', ], $contentType, @@ -1232,18 +1224,6 @@ public function downloadWithHttpInfo($environment, $path, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { default: @@ -1275,6 +1255,19 @@ public function downloadWithHttpInfo($environment, $path, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SourceCode\Model\Error'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Cms/SourceCode/Api/ExtractApi.php b/codegen/Cms/SourceCode/Api/ExtractApi.php index 989b8d473..496a0a71b 100644 --- a/codegen/Cms/SourceCode/Api/ExtractApi.php +++ b/codegen/Cms/SourceCode/Api/ExtractApi.php @@ -10,13 +10,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class ExtractApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -181,18 +181,6 @@ public function doAsyncWithHttpInfo($file_extract_request, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 202: @@ -251,6 +239,19 @@ public function doAsyncWithHttpInfo($file_extract_request, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SourceCode\Model\TaskLocator'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -526,18 +527,6 @@ public function getAsyncStatusWithHttpInfo($task_id, string $contentType = self: $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -596,6 +585,19 @@ public function getAsyncStatusWithHttpInfo($task_id, string $contentType = self: ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SourceCode\Model\ActionResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Cms/SourceCode/Api/MetadataApi.php b/codegen/Cms/SourceCode/Api/MetadataApi.php index 335733fbb..58e2a2b25 100644 --- a/codegen/Cms/SourceCode/Api/MetadataApi.php +++ b/codegen/Cms/SourceCode/Api/MetadataApi.php @@ -10,13 +10,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class MetadataApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -129,7 +129,7 @@ public function getConfig() * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param string $properties properties (optional) + * @param string|null $properties properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -149,7 +149,7 @@ public function get($environment, $path, $properties = null, string $contentType * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param string $properties (optional) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -182,18 +182,6 @@ public function getWithHttpInfo($environment, $path, $properties = null, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -252,6 +240,19 @@ public function getWithHttpInfo($environment, $path, $properties = null, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SourceCode\Model\AssetFileMetadata'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -310,7 +311,7 @@ public function getWithHttpInfo($environment, $path, $properties = null, string * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param string $properties (optional) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -333,7 +334,7 @@ function ($response) { * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param string $properties (optional) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -385,7 +386,7 @@ function ($exception) { * * @param string $environment The environment of the file (\"draft\" or \"published\"). (required) * @param string $path The file system location of the file. (required) - * @param string $properties (optional) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Cms/SourceCode/Api/ValidationApi.php b/codegen/Cms/SourceCode/Api/ValidationApi.php index 17cf03e81..20a313e8d 100644 --- a/codegen/Cms/SourceCode/Api/ValidationApi.php +++ b/codegen/Cms/SourceCode/Api/ValidationApi.php @@ -10,13 +10,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class ValidationApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -128,7 +128,7 @@ public function getConfig() * Validate the contents of a file * * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file file (optional) + * @param \SplFileObject|null $file file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doValidate'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -147,7 +147,7 @@ public function doValidate($path, $file = null, string $contentType = self::cont * Validate the contents of a file * * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doValidate'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\SourceCode\ApiException on non-2xx response or if the response body is not in the expected format @@ -180,18 +180,6 @@ public function doValidateWithHttpInfo($path, $file = null, string $contentType $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { default: @@ -223,6 +211,19 @@ public function doValidateWithHttpInfo($path, $file = null, string $contentType ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\SourceCode\Model\Error'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -272,7 +273,7 @@ public function doValidateWithHttpInfo($path, $file = null, string $contentType * Validate the contents of a file * * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doValidate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -294,7 +295,7 @@ function ($response) { * Validate the contents of a file * * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doValidate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -345,7 +346,7 @@ function ($exception) { * Create request for operation 'doValidate' * * @param string $path The file system location of the file. (required) - * @param \SplFileObject $file (optional) + * @param \SplFileObject|null $file (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doValidate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -397,6 +398,7 @@ public function doValidateRequest($path, $file = null, string $contentType = sel } } + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['*/*', ], $contentType, diff --git a/codegen/Cms/SourceCode/ApiException.php b/codegen/Cms/SourceCode/ApiException.php index 741a3e941..2ef6e4e65 100644 --- a/codegen/Cms/SourceCode/ApiException.php +++ b/codegen/Cms/SourceCode/ApiException.php @@ -10,13 +10,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/SourceCode/Configuration.php b/codegen/Cms/SourceCode/Configuration.php index b16acaf76..644e899e2 100644 --- a/codegen/Cms/SourceCode/Configuration.php +++ b/codegen/Cms/SourceCode/Configuration.php @@ -10,13 +10,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/SourceCode/HeaderSelector.php b/codegen/Cms/SourceCode/HeaderSelector.php index b6f9ad0e5..89cd7039e 100644 --- a/codegen/Cms/SourceCode/HeaderSelector.php +++ b/codegen/Cms/SourceCode/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/SourceCode/Model/ActionResponse.php b/codegen/Cms/SourceCode/Model/ActionResponse.php index f7e545d0a..d19b5ce14 100644 --- a/codegen/Cms/SourceCode/Model/ActionResponse.php +++ b/codegen/Cms/SourceCode/Model/ActionResponse.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Cms/SourceCode/Model/AssetFileMetadata.php b/codegen/Cms/SourceCode/Model/AssetFileMetadata.php index a0a21309e..94a38e17b 100644 --- a/codegen/Cms/SourceCode/Model/AssetFileMetadata.php +++ b/codegen/Cms/SourceCode/Model/AssetFileMetadata.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); diff --git a/codegen/Cms/SourceCode/Model/Error.php b/codegen/Cms/SourceCode/Model/Error.php index a672e098e..c30dafd17 100644 --- a/codegen/Cms/SourceCode/Model/Error.php +++ b/codegen/Cms/SourceCode/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/SourceCode/Model/ErrorDetail.php b/codegen/Cms/SourceCode/Model/ErrorDetail.php index e81a1b956..9d706d064 100644 --- a/codegen/Cms/SourceCode/Model/ErrorDetail.php +++ b/codegen/Cms/SourceCode/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/SourceCode/Model/FileExtractRequest.php b/codegen/Cms/SourceCode/Model/FileExtractRequest.php index e227bbf81..eca7b6730 100644 --- a/codegen/Cms/SourceCode/Model/FileExtractRequest.php +++ b/codegen/Cms/SourceCode/Model/FileExtractRequest.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('path', $data ?? [], null); } diff --git a/codegen/Cms/SourceCode/Model/ModelInterface.php b/codegen/Cms/SourceCode/Model/ModelInterface.php index ba0cd4229..66e15c5df 100644 --- a/codegen/Cms/SourceCode/Model/ModelInterface.php +++ b/codegen/Cms/SourceCode/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/SourceCode/Model/TaskLocator.php b/codegen/Cms/SourceCode/Model/TaskLocator.php index af9941250..c903746ed 100644 --- a/codegen/Cms/SourceCode/Model/TaskLocator.php +++ b/codegen/Cms/SourceCode/Model/TaskLocator.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('links', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Cms/SourceCode/ObjectSerializer.php b/codegen/Cms/SourceCode/ObjectSerializer.php index 9173ac6a6..66ab500f8 100644 --- a/codegen/Cms/SourceCode/ObjectSerializer.php +++ b/codegen/Cms/SourceCode/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * CMS Source Code + * Source Code * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Cms/UrlRedirects/Api/RedirectsApi.php b/codegen/Cms/UrlRedirects/Api/RedirectsApi.php index d60ee7a8a..7d3f1f93e 100644 --- a/codegen/Cms/UrlRedirects/Api/RedirectsApi.php +++ b/codegen/Cms/UrlRedirects/Api/RedirectsApi.php @@ -10,13 +10,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class RedirectsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($url_redirect_id, string $contentType = self $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($url_mapping_create_request_body, string $con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($url_mapping_create_request_body, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -776,18 +765,6 @@ public function getByIdWithHttpInfo($url_redirect_id, string $contentType = self $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -846,6 +823,19 @@ public function getByIdWithHttpInfo($url_redirect_id, string $contentType = self ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1071,16 +1061,16 @@ public function getByIdRequest($url_redirect_id, string $contentType = self::con * * Get current redirects * - * @param \DateTime $created_at Only return redirects created on exactly this date. (optional) - * @param \DateTime $created_after Only return redirects created after this date. (optional) - * @param \DateTime $created_before Only return redirects created before this date. (optional) - * @param \DateTime $updated_at Only return redirects last updated on exactly this date. (optional) - * @param \DateTime $updated_after Only return redirects last updated after this date. (optional) - * @param \DateTime $updated_before Only return redirects last updated before this date. (optional) - * @param string[] $sort sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of result per page (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return redirects created on exactly this date. (optional) + * @param \DateTime|null $created_after Only return redirects created after this date. (optional) + * @param \DateTime|null $created_before Only return redirects created before this date. (optional) + * @param \DateTime|null $updated_at Only return redirects last updated on exactly this date. (optional) + * @param \DateTime|null $updated_after Only return redirects last updated after this date. (optional) + * @param \DateTime|null $updated_before Only return redirects last updated before this date. (optional) + * @param string[]|null $sort sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of result per page (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format @@ -1098,16 +1088,16 @@ public function getPage($created_at = null, $created_after = null, $created_befo * * Get current redirects * - * @param \DateTime $created_at Only return redirects created on exactly this date. (optional) - * @param \DateTime $created_after Only return redirects created after this date. (optional) - * @param \DateTime $created_before Only return redirects created before this date. (optional) - * @param \DateTime $updated_at Only return redirects last updated on exactly this date. (optional) - * @param \DateTime $updated_after Only return redirects last updated after this date. (optional) - * @param \DateTime $updated_before Only return redirects last updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of result per page (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return redirects created on exactly this date. (optional) + * @param \DateTime|null $created_after Only return redirects created after this date. (optional) + * @param \DateTime|null $created_before Only return redirects created before this date. (optional) + * @param \DateTime|null $updated_at Only return redirects last updated on exactly this date. (optional) + * @param \DateTime|null $updated_after Only return redirects last updated after this date. (optional) + * @param \DateTime|null $updated_before Only return redirects last updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of result per page (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Cms\UrlRedirects\ApiException on non-2xx response or if the response body is not in the expected format @@ -1140,18 +1130,6 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1210,6 +1188,19 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\CollectionResponseWithTotalUrlMappingForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1266,16 +1257,16 @@ public function getPageWithHttpInfo($created_at = null, $created_after = null, $ * * Get current redirects * - * @param \DateTime $created_at Only return redirects created on exactly this date. (optional) - * @param \DateTime $created_after Only return redirects created after this date. (optional) - * @param \DateTime $created_before Only return redirects created before this date. (optional) - * @param \DateTime $updated_at Only return redirects last updated on exactly this date. (optional) - * @param \DateTime $updated_after Only return redirects last updated after this date. (optional) - * @param \DateTime $updated_before Only return redirects last updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of result per page (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return redirects created on exactly this date. (optional) + * @param \DateTime|null $created_after Only return redirects created after this date. (optional) + * @param \DateTime|null $created_before Only return redirects created before this date. (optional) + * @param \DateTime|null $updated_at Only return redirects last updated on exactly this date. (optional) + * @param \DateTime|null $updated_after Only return redirects last updated after this date. (optional) + * @param \DateTime|null $updated_before Only return redirects last updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of result per page (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1296,16 +1287,16 @@ function ($response) { * * Get current redirects * - * @param \DateTime $created_at Only return redirects created on exactly this date. (optional) - * @param \DateTime $created_after Only return redirects created after this date. (optional) - * @param \DateTime $created_before Only return redirects created before this date. (optional) - * @param \DateTime $updated_at Only return redirects last updated on exactly this date. (optional) - * @param \DateTime $updated_after Only return redirects last updated after this date. (optional) - * @param \DateTime $updated_before Only return redirects last updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of result per page (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return redirects created on exactly this date. (optional) + * @param \DateTime|null $created_after Only return redirects created after this date. (optional) + * @param \DateTime|null $created_before Only return redirects created before this date. (optional) + * @param \DateTime|null $updated_at Only return redirects last updated on exactly this date. (optional) + * @param \DateTime|null $updated_after Only return redirects last updated after this date. (optional) + * @param \DateTime|null $updated_before Only return redirects last updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of result per page (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1355,16 +1346,16 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param \DateTime $created_at Only return redirects created on exactly this date. (optional) - * @param \DateTime $created_after Only return redirects created after this date. (optional) - * @param \DateTime $created_before Only return redirects created before this date. (optional) - * @param \DateTime $updated_at Only return redirects last updated on exactly this date. (optional) - * @param \DateTime $updated_after Only return redirects last updated after this date. (optional) - * @param \DateTime $updated_before Only return redirects last updated before this date. (optional) - * @param string[] $sort (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit Maximum number of result per page (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param \DateTime|null $created_at Only return redirects created on exactly this date. (optional) + * @param \DateTime|null $created_after Only return redirects created after this date. (optional) + * @param \DateTime|null $created_before Only return redirects created before this date. (optional) + * @param \DateTime|null $updated_at Only return redirects last updated on exactly this date. (optional) + * @param \DateTime|null $updated_after Only return redirects last updated after this date. (optional) + * @param \DateTime|null $updated_before Only return redirects last updated before this date. (optional) + * @param string[]|null $sort (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit Maximum number of result per page (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1600,18 +1591,6 @@ public function updateWithHttpInfo($url_redirect_id, $url_mapping, string $conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1670,6 +1649,19 @@ public function updateWithHttpInfo($url_redirect_id, $url_mapping, string $conte ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Cms\UrlRedirects\Model\UrlMapping'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Cms/UrlRedirects/ApiException.php b/codegen/Cms/UrlRedirects/ApiException.php index 5d2299fdc..0597ecf3e 100644 --- a/codegen/Cms/UrlRedirects/ApiException.php +++ b/codegen/Cms/UrlRedirects/ApiException.php @@ -10,13 +10,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Cms/UrlRedirects/Configuration.php b/codegen/Cms/UrlRedirects/Configuration.php index dda854482..3ac42677d 100644 --- a/codegen/Cms/UrlRedirects/Configuration.php +++ b/codegen/Cms/UrlRedirects/Configuration.php @@ -10,13 +10,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Cms/UrlRedirects/HeaderSelector.php b/codegen/Cms/UrlRedirects/HeaderSelector.php index 5762a9557..875088de4 100644 --- a/codegen/Cms/UrlRedirects/HeaderSelector.php +++ b/codegen/Cms/UrlRedirects/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Cms/UrlRedirects/Model/CollectionResponseWithTotalUrlMappingForwardPaging.php b/codegen/Cms/UrlRedirects/Model/CollectionResponseWithTotalUrlMappingForwardPaging.php index 7fdfa15d0..c8ddf0c1f 100644 --- a/codegen/Cms/UrlRedirects/Model/CollectionResponseWithTotalUrlMappingForwardPaging.php +++ b/codegen/Cms/UrlRedirects/Model/CollectionResponseWithTotalUrlMappingForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Cms/UrlRedirects/Model/Error.php b/codegen/Cms/UrlRedirects/Model/Error.php index 5dba9267e..59cce5a1c 100644 --- a/codegen/Cms/UrlRedirects/Model/Error.php +++ b/codegen/Cms/UrlRedirects/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Cms/UrlRedirects/Model/ErrorDetail.php b/codegen/Cms/UrlRedirects/Model/ErrorDetail.php index fdb97fa12..b4f18fbbc 100644 --- a/codegen/Cms/UrlRedirects/Model/ErrorDetail.php +++ b/codegen/Cms/UrlRedirects/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Cms/UrlRedirects/Model/ForwardPaging.php b/codegen/Cms/UrlRedirects/Model/ForwardPaging.php index bdd649279..53d173f47 100644 --- a/codegen/Cms/UrlRedirects/Model/ForwardPaging.php +++ b/codegen/Cms/UrlRedirects/Model/ForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Cms/UrlRedirects/Model/ModelInterface.php b/codegen/Cms/UrlRedirects/Model/ModelInterface.php index f8cfe73c7..4bdc0f458 100644 --- a/codegen/Cms/UrlRedirects/Model/ModelInterface.php +++ b/codegen/Cms/UrlRedirects/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Cms/UrlRedirects/Model/NextPage.php b/codegen/Cms/UrlRedirects/Model/NextPage.php index 9104737e9..09366c85e 100644 --- a/codegen/Cms/UrlRedirects/Model/NextPage.php +++ b/codegen/Cms/UrlRedirects/Model/NextPage.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Cms/UrlRedirects/Model/UrlMapping.php b/codegen/Cms/UrlRedirects/Model/UrlMapping.php index 4a7ffc56a..88ca7095d 100644 --- a/codegen/Cms/UrlRedirects/Model/UrlMapping.php +++ b/codegen/Cms/UrlRedirects/Model/UrlMapping.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -311,10 +311,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('is_trailing_slash_optional', $data ?? [], null); $this->setIfExists('redirect_style', $data ?? [], null); diff --git a/codegen/Cms/UrlRedirects/Model/UrlMappingCreateRequestBody.php b/codegen/Cms/UrlRedirects/Model/UrlMappingCreateRequestBody.php index 971ac202d..d8e4a8da4 100644 --- a/codegen/Cms/UrlRedirects/Model/UrlMappingCreateRequestBody.php +++ b/codegen/Cms/UrlRedirects/Model/UrlMappingCreateRequestBody.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -293,10 +293,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('is_trailing_slash_optional', $data ?? [], null); $this->setIfExists('is_match_query_string', $data ?? [], null); diff --git a/codegen/Cms/UrlRedirects/ObjectSerializer.php b/codegen/Cms/UrlRedirects/ObjectSerializer.php index efa761bd4..f419acab1 100644 --- a/codegen/Cms/UrlRedirects/ObjectSerializer.php +++ b/codegen/Cms/UrlRedirects/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * CMS Url Redirects + * Url Redirects * * URL redirect operations * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/CommunicationPreferences/Api/DefinitionApi.php b/codegen/CommunicationPreferences/Api/DefinitionApi.php index b7fa68f95..d55dda402 100644 --- a/codegen/CommunicationPreferences/Api/DefinitionApi.php +++ b/codegen/CommunicationPreferences/Api/DefinitionApi.php @@ -10,13 +10,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class DefinitionApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -176,18 +176,6 @@ public function getPageWithHttpInfo(string $contentType = self::contentTypes['ge $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -246,6 +234,19 @@ public function getPageWithHttpInfo(string $contentType = self::contentTypes['ge ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/CommunicationPreferences/Api/StatusApi.php b/codegen/CommunicationPreferences/Api/StatusApi.php index eba75989f..9a708ca30 100644 --- a/codegen/CommunicationPreferences/Api/StatusApi.php +++ b/codegen/CommunicationPreferences/Api/StatusApi.php @@ -10,13 +10,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -89,13 +89,13 @@ class StatusApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -184,18 +184,6 @@ public function getEmailStatusWithHttpInfo($email_address, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -254,6 +242,19 @@ public function getEmailStatusWithHttpInfo($email_address, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -530,18 +531,6 @@ public function subscribeWithHttpInfo($public_update_subscription_status_request $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -600,6 +589,19 @@ public function subscribeWithHttpInfo($public_update_subscription_status_request ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -875,18 +877,6 @@ public function unsubscribeWithHttpInfo($public_update_subscription_status_reque $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -945,6 +935,19 @@ public function unsubscribeWithHttpInfo($public_update_subscription_status_reque ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/CommunicationPreferences/ApiException.php b/codegen/CommunicationPreferences/ApiException.php index d93772511..55d2bcee3 100644 --- a/codegen/CommunicationPreferences/ApiException.php +++ b/codegen/CommunicationPreferences/ApiException.php @@ -10,13 +10,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/CommunicationPreferences/Configuration.php b/codegen/CommunicationPreferences/Configuration.php index 124d2a26d..84beb3eca 100644 --- a/codegen/CommunicationPreferences/Configuration.php +++ b/codegen/CommunicationPreferences/Configuration.php @@ -10,13 +10,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/CommunicationPreferences/HeaderSelector.php b/codegen/CommunicationPreferences/HeaderSelector.php index 84e6b54b0..8a3caaa4b 100644 --- a/codegen/CommunicationPreferences/HeaderSelector.php +++ b/codegen/CommunicationPreferences/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/CommunicationPreferences/Model/Error.php b/codegen/CommunicationPreferences/Model/Error.php index 0f292a873..08bcc87b4 100644 --- a/codegen/CommunicationPreferences/Model/Error.php +++ b/codegen/CommunicationPreferences/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/CommunicationPreferences/Model/ErrorDetail.php b/codegen/CommunicationPreferences/Model/ErrorDetail.php index 228fc4e86..de4b450e2 100644 --- a/codegen/CommunicationPreferences/Model/ErrorDetail.php +++ b/codegen/CommunicationPreferences/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/CommunicationPreferences/Model/ModelInterface.php b/codegen/CommunicationPreferences/Model/ModelInterface.php index de8a84a1d..c80bc030c 100644 --- a/codegen/CommunicationPreferences/Model/ModelInterface.php +++ b/codegen/CommunicationPreferences/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php index 4b976f829..595312462 100644 --- a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php +++ b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -344,10 +344,10 @@ public function getSourceOfStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('brand_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php index 7ab1094e3..e707071cb 100644 --- a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php +++ b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('recipient', $data ?? [], null); $this->setIfExists('subscription_statuses', $data ?? [], null); diff --git a/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php b/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php index 15385cc8a..7b2da3beb 100644 --- a/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php +++ b/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getLegalBasisAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('email_address', $data ?? [], null); $this->setIfExists('legal_basis', $data ?? [], null); diff --git a/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php b/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php index 51ce5daf9..8e74c23fd 100644 --- a/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php +++ b/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -299,10 +299,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('is_internal', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); diff --git a/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php b/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php index 22ea1b656..7ee533f9b 100644 --- a/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php +++ b/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('subscription_definitions', $data ?? [], null); } diff --git a/codegen/CommunicationPreferences/ObjectSerializer.php b/codegen/CommunicationPreferences/ObjectSerializer.php index a10b3c894..9ca6f157c 100644 --- a/codegen/CommunicationPreferences/ObjectSerializer.php +++ b/codegen/CommunicationPreferences/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * Communication Preferences Subscriptions + * Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Conversations/VisitorIdentification/Api/GenerateApi.php b/codegen/Conversations/VisitorIdentification/Api/GenerateApi.php index 7995ff77c..9cf5f359d 100644 --- a/codegen/Conversations/VisitorIdentification/Api/GenerateApi.php +++ b/codegen/Conversations/VisitorIdentification/Api/GenerateApi.php @@ -10,13 +10,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class GenerateApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -178,18 +178,6 @@ public function generateTokenWithHttpInfo($identification_token_generation_reque $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -248,6 +236,19 @@ public function generateTokenWithHttpInfo($identification_token_generation_reque ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Conversations\VisitorIdentification\Model\IdentificationTokenResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Conversations/VisitorIdentification/ApiException.php b/codegen/Conversations/VisitorIdentification/ApiException.php index c86ee7ab5..2fa55ca9c 100644 --- a/codegen/Conversations/VisitorIdentification/ApiException.php +++ b/codegen/Conversations/VisitorIdentification/ApiException.php @@ -10,13 +10,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Conversations/VisitorIdentification/Configuration.php b/codegen/Conversations/VisitorIdentification/Configuration.php index a2c411151..52def915c 100644 --- a/codegen/Conversations/VisitorIdentification/Configuration.php +++ b/codegen/Conversations/VisitorIdentification/Configuration.php @@ -10,13 +10,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Conversations/VisitorIdentification/HeaderSelector.php b/codegen/Conversations/VisitorIdentification/HeaderSelector.php index 2c98be879..924985474 100644 --- a/codegen/Conversations/VisitorIdentification/HeaderSelector.php +++ b/codegen/Conversations/VisitorIdentification/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Conversations/VisitorIdentification/Model/Error.php b/codegen/Conversations/VisitorIdentification/Model/Error.php index 3d030a9a2..713f5d20f 100644 --- a/codegen/Conversations/VisitorIdentification/Model/Error.php +++ b/codegen/Conversations/VisitorIdentification/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Conversations/VisitorIdentification/Model/ErrorDetail.php b/codegen/Conversations/VisitorIdentification/Model/ErrorDetail.php index 794fa9b1d..5b36b8f82 100644 --- a/codegen/Conversations/VisitorIdentification/Model/ErrorDetail.php +++ b/codegen/Conversations/VisitorIdentification/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenGenerationRequest.php b/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenGenerationRequest.php index 5de21762f..e3f18d1a5 100644 --- a/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenGenerationRequest.php +++ b/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenGenerationRequest.php @@ -11,13 +11,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('first_name', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); diff --git a/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenResponse.php b/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenResponse.php index 3bf36fc6b..f4ad46fa2 100644 --- a/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenResponse.php +++ b/codegen/Conversations/VisitorIdentification/Model/IdentificationTokenResponse.php @@ -11,13 +11,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('token', $data ?? [], null); } diff --git a/codegen/Conversations/VisitorIdentification/Model/ModelInterface.php b/codegen/Conversations/VisitorIdentification/Model/ModelInterface.php index 8881bf03a..995aac14f 100644 --- a/codegen/Conversations/VisitorIdentification/Model/ModelInterface.php +++ b/codegen/Conversations/VisitorIdentification/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Conversations/VisitorIdentification/ObjectSerializer.php b/codegen/Conversations/VisitorIdentification/ObjectSerializer.php index f1b3eac81..2b46ce954 100644 --- a/codegen/Conversations/VisitorIdentification/ObjectSerializer.php +++ b/codegen/Conversations/VisitorIdentification/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * Visitor Identification + * Conversations Visitor Identification * * The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Associations/Api/BatchApi.php b/codegen/Crm/Associations/Api/BatchApi.php index 238801f14..e2bd0e6c1 100644 --- a/codegen/Crm/Associations/Api/BatchApi.php +++ b/codegen/Crm/Associations/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -89,13 +89,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -187,18 +187,6 @@ public function archiveWithHttpInfo($from_object_type, $to_object_type, $batch_i $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -468,18 +456,6 @@ public function createWithHttpInfo($from_object_type, $to_object_type, $batch_in $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -565,6 +541,19 @@ public function createWithHttpInfo($from_object_type, $to_object_type, $batch_in ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociation'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -888,18 +877,6 @@ public function readWithHttpInfo($from_object_type, $to_object_type, $batch_inpu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -985,6 +962,19 @@ public function readWithHttpInfo($from_object_type, $to_object_type, $batch_inpu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Associations/ApiException.php b/codegen/Crm/Associations/ApiException.php index e0128a445..d8dd121c2 100644 --- a/codegen/Crm/Associations/ApiException.php +++ b/codegen/Crm/Associations/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Associations/Configuration.php b/codegen/Crm/Associations/Configuration.php index ea13e9b67..73f5c5421 100644 --- a/codegen/Crm/Associations/Configuration.php +++ b/codegen/Crm/Associations/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Associations/HeaderSelector.php b/codegen/Crm/Associations/HeaderSelector.php index e12aa5ea9..22bf4df77 100644 --- a/codegen/Crm/Associations/HeaderSelector.php +++ b/codegen/Crm/Associations/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Associations/Model/AssociatedId.php b/codegen/Crm/Associations/Model/AssociatedId.php index 415b26c17..1d9559cf6 100644 --- a/codegen/Crm/Associations/Model/AssociatedId.php +++ b/codegen/Crm/Associations/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/BatchInputPublicAssociation.php b/codegen/Crm/Associations/Model/BatchInputPublicAssociation.php index 595879cae..02d24cb30 100644 --- a/codegen/Crm/Associations/Model/BatchInputPublicAssociation.php +++ b/codegen/Crm/Associations/Model/BatchInputPublicAssociation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Associations/Model/BatchInputPublicObjectId.php b/codegen/Crm/Associations/Model/BatchInputPublicObjectId.php index 92f42a156..055bae090 100644 --- a/codegen/Crm/Associations/Model/BatchInputPublicObjectId.php +++ b/codegen/Crm/Associations/Model/BatchInputPublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Associations/Model/BatchResponsePublicAssociation.php b/codegen/Crm/Associations/Model/BatchResponsePublicAssociation.php index 889a71324..7e2bf534c 100644 --- a/codegen/Crm/Associations/Model/BatchResponsePublicAssociation.php +++ b/codegen/Crm/Associations/Model/BatchResponsePublicAssociation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMulti.php b/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMulti.php index ee85334d9..ce91abbc7 100644 --- a/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMulti.php +++ b/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMulti.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMultiWithErrors.php b/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMultiWithErrors.php index 568b41699..f8a1c7953 100644 --- a/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMultiWithErrors.php +++ b/codegen/Crm/Associations/Model/BatchResponsePublicAssociationMultiWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/BatchResponsePublicAssociationWithErrors.php b/codegen/Crm/Associations/Model/BatchResponsePublicAssociationWithErrors.php index 951127886..23571b9cd 100644 --- a/codegen/Crm/Associations/Model/BatchResponsePublicAssociationWithErrors.php +++ b/codegen/Crm/Associations/Model/BatchResponsePublicAssociationWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/Error.php b/codegen/Crm/Associations/Model/Error.php index 28baf76df..a949e3133 100644 --- a/codegen/Crm/Associations/Model/Error.php +++ b/codegen/Crm/Associations/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/ErrorDetail.php b/codegen/Crm/Associations/Model/ErrorDetail.php index c07caf865..6c20d1d7f 100644 --- a/codegen/Crm/Associations/Model/ErrorDetail.php +++ b/codegen/Crm/Associations/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/ModelInterface.php b/codegen/Crm/Associations/Model/ModelInterface.php index f53c80a07..cfa7938a3 100644 --- a/codegen/Crm/Associations/Model/ModelInterface.php +++ b/codegen/Crm/Associations/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Associations/Model/NextPage.php b/codegen/Crm/Associations/Model/NextPage.php index 722b24a8f..fdc269cc4 100644 --- a/codegen/Crm/Associations/Model/NextPage.php +++ b/codegen/Crm/Associations/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/Paging.php b/codegen/Crm/Associations/Model/Paging.php index 5ae9f01dd..e495c9691 100644 --- a/codegen/Crm/Associations/Model/Paging.php +++ b/codegen/Crm/Associations/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/PreviousPage.php b/codegen/Crm/Associations/Model/PreviousPage.php index 82378a938..3d0c3a800 100644 --- a/codegen/Crm/Associations/Model/PreviousPage.php +++ b/codegen/Crm/Associations/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/PublicAssociation.php b/codegen/Crm/Associations/Model/PublicAssociation.php index fa0786a2f..9d133633c 100644 --- a/codegen/Crm/Associations/Model/PublicAssociation.php +++ b/codegen/Crm/Associations/Model/PublicAssociation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('from', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/PublicAssociationMulti.php b/codegen/Crm/Associations/Model/PublicAssociationMulti.php index d49ba00da..19e02258c 100644 --- a/codegen/Crm/Associations/Model/PublicAssociationMulti.php +++ b/codegen/Crm/Associations/Model/PublicAssociationMulti.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('from', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Associations/Model/PublicObjectId.php b/codegen/Crm/Associations/Model/PublicObjectId.php index 6770fd1e5..3a76be4ec 100644 --- a/codegen/Crm/Associations/Model/PublicObjectId.php +++ b/codegen/Crm/Associations/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Associations/Model/StandardError.php b/codegen/Crm/Associations/Model/StandardError.php index 14f4bbf82..d1453d744 100644 --- a/codegen/Crm/Associations/Model/StandardError.php +++ b/codegen/Crm/Associations/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Associations/ObjectSerializer.php b/codegen/Crm/Associations/ObjectSerializer.php index dc1e3cbcb..4f06ae52f 100644 --- a/codegen/Crm/Associations/ObjectSerializer.php +++ b/codegen/Crm/Associations/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Associations/Schema/Api/TypesApi.php b/codegen/Crm/Associations/Schema/Api/TypesApi.php index 2a1339d6d..36a4dccc9 100644 --- a/codegen/Crm/Associations/Schema/Api/TypesApi.php +++ b/codegen/Crm/Associations/Schema/Api/TypesApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class TypesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -180,18 +180,6 @@ public function getAllWithHttpInfo($from_object_type, $to_object_type, string $c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -250,6 +238,19 @@ public function getAllWithHttpInfo($from_object_type, $to_object_type, string $c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\Schema\Model\CollectionResponsePublicAssociationDefinitionNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Associations/Schema/ApiException.php b/codegen/Crm/Associations/Schema/ApiException.php index 652a02061..87dc394bd 100644 --- a/codegen/Crm/Associations/Schema/ApiException.php +++ b/codegen/Crm/Associations/Schema/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Associations/Schema/Configuration.php b/codegen/Crm/Associations/Schema/Configuration.php index 6a7dfaf24..67df3a270 100644 --- a/codegen/Crm/Associations/Schema/Configuration.php +++ b/codegen/Crm/Associations/Schema/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Associations/Schema/HeaderSelector.php b/codegen/Crm/Associations/Schema/HeaderSelector.php index 9cfcc5fc5..69b371485 100644 --- a/codegen/Crm/Associations/Schema/HeaderSelector.php +++ b/codegen/Crm/Associations/Schema/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Associations/Schema/Model/CollectionResponsePublicAssociationDefinitionNoPaging.php b/codegen/Crm/Associations/Schema/Model/CollectionResponsePublicAssociationDefinitionNoPaging.php index d8ee93ba1..7319e6fd8 100644 --- a/codegen/Crm/Associations/Schema/Model/CollectionResponsePublicAssociationDefinitionNoPaging.php +++ b/codegen/Crm/Associations/Schema/Model/CollectionResponsePublicAssociationDefinitionNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Associations/Schema/Model/Error.php b/codegen/Crm/Associations/Schema/Model/Error.php index ce4ff3cd3..75bc917cb 100644 --- a/codegen/Crm/Associations/Schema/Model/Error.php +++ b/codegen/Crm/Associations/Schema/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Associations/Schema/Model/ErrorDetail.php b/codegen/Crm/Associations/Schema/Model/ErrorDetail.php index c4d0c634e..aae9ee133 100644 --- a/codegen/Crm/Associations/Schema/Model/ErrorDetail.php +++ b/codegen/Crm/Associations/Schema/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Associations/Schema/Model/ModelInterface.php b/codegen/Crm/Associations/Schema/Model/ModelInterface.php index b62a0e24e..3972f3939 100644 --- a/codegen/Crm/Associations/Schema/Model/ModelInterface.php +++ b/codegen/Crm/Associations/Schema/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Associations/Schema/Model/PublicAssociationDefinition.php b/codegen/Crm/Associations/Schema/Model/PublicAssociationDefinition.php index ed91cd18c..47906e310 100644 --- a/codegen/Crm/Associations/Schema/Model/PublicAssociationDefinition.php +++ b/codegen/Crm/Associations/Schema/Model/PublicAssociationDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Crm/Associations/Schema/ObjectSerializer.php b/codegen/Crm/Associations/Schema/ObjectSerializer.php index d9200c1a5..1ecb016e9 100644 --- a/codegen/Crm/Associations/Schema/ObjectSerializer.php +++ b/codegen/Crm/Associations/Schema/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Associations/V4/Api/BasicApi.php b/codegen/Crm/Associations/V4/Api/BasicApi.php index 2581a41be..6dcc7883f 100644 --- a/codegen/Crm/Associations/V4/Api/BasicApi.php +++ b/codegen/Crm/Associations/V4/Api/BasicApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -92,13 +92,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -192,18 +192,6 @@ public function archiveWithHttpInfo($object_type, $object_id, $to_object_type, $ $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -496,18 +484,6 @@ public function createWithHttpInfo($object_type, $object_id, $to_object_type, $t $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -566,6 +542,19 @@ public function createWithHttpInfo($object_type, $object_id, $to_object_type, $t ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\LabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -919,18 +908,6 @@ public function createDefaultWithHttpInfo($from_object_type, $from_object_id, $t $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -989,6 +966,19 @@ public function createDefaultWithHttpInfo($from_object_type, $from_object_id, $t ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1271,8 +1261,8 @@ public function createDefaultRequest($from_object_type, $from_object_id, $to_obj * @param string $object_type object_type (required) * @param string $object_id object_id (required) * @param string $to_object_type to_object_type (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 500) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response or if the response body is not in the expected format @@ -1293,8 +1283,8 @@ public function getPage($object_type, $object_id, $to_object_type, $after = null * @param string $object_type (required) * @param string $object_id (required) * @param string $to_object_type (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 500) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\ApiException on non-2xx response or if the response body is not in the expected format @@ -1327,18 +1317,6 @@ public function getPageWithHttpInfo($object_type, $object_id, $to_object_type, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1397,6 +1375,19 @@ public function getPageWithHttpInfo($object_type, $object_id, $to_object_type, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1456,8 +1447,8 @@ public function getPageWithHttpInfo($object_type, $object_id, $to_object_type, $ * @param string $object_type (required) * @param string $object_id (required) * @param string $to_object_type (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 500) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1481,8 +1472,8 @@ function ($response) { * @param string $object_type (required) * @param string $object_id (required) * @param string $to_object_type (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 500) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1535,8 +1526,8 @@ function ($exception) { * @param string $object_type (required) * @param string $object_id (required) * @param string $to_object_type (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 500) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 500) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Associations/V4/Api/BatchApi.php b/codegen/Crm/Associations/V4/Api/BatchApi.php index c65f35095..45032fe88 100644 --- a/codegen/Crm/Associations/V4/Api/BatchApi.php +++ b/codegen/Crm/Associations/V4/Api/BatchApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -193,18 +193,6 @@ public function archiveWithHttpInfo($from_object_type, $to_object_type, $batch_i $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -473,18 +461,6 @@ public function archiveLabelsWithHttpInfo($from_object_type, $to_object_type, $b $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -754,18 +730,6 @@ public function createWithHttpInfo($from_object_type, $to_object_type, $batch_in $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -851,6 +815,19 @@ public function createWithHttpInfo($from_object_type, $to_object_type, $batch_in ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponseLabelsBetweenObjectPair'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1174,18 +1151,6 @@ public function createDefaultWithHttpInfo($from_object_type, $to_object_type, $b $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1244,6 +1209,19 @@ public function createDefaultWithHttpInfo($from_object_type, $to_object_type, $b ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicDefaultAssociation'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1559,18 +1537,6 @@ public function getPageWithHttpInfo($from_object_type, $to_object_type, $batch_i $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1656,6 +1622,19 @@ public function getPageWithHttpInfo($from_object_type, $to_object_type, $batch_i ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\BatchResponsePublicAssociationMultiWithLabel'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Associations/V4/Api/ReportApi.php b/codegen/Crm/Associations/V4/Api/ReportApi.php index 49fbd9e7d..d47c413a5 100644 --- a/codegen/Crm/Associations/V4/Api/ReportApi.php +++ b/codegen/Crm/Associations/V4/Api/ReportApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class ReportApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -178,18 +178,6 @@ public function requestWithHttpInfo($user_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -248,6 +236,19 @@ public function requestWithHttpInfo($user_id, string $contentType = self::conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Model\ReportCreationResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Associations/V4/ApiException.php b/codegen/Crm/Associations/V4/ApiException.php index 42276ca5a..6a2a33707 100644 --- a/codegen/Crm/Associations/V4/ApiException.php +++ b/codegen/Crm/Associations/V4/ApiException.php @@ -10,13 +10,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Associations/V4/Configuration.php b/codegen/Crm/Associations/V4/Configuration.php index 4dc56f855..b6ea422fe 100644 --- a/codegen/Crm/Associations/V4/Configuration.php +++ b/codegen/Crm/Associations/V4/Configuration.php @@ -10,13 +10,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Associations/V4/HeaderSelector.php b/codegen/Crm/Associations/V4/HeaderSelector.php index 519fb3299..c395f8a66 100644 --- a/codegen/Crm/Associations/V4/HeaderSelector.php +++ b/codegen/Crm/Associations/V4/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Associations/V4/Model/AssociationSpec.php b/codegen/Crm/Associations/V4/Model/AssociationSpec.php index 83236fb89..c7f6c1056 100644 --- a/codegen/Crm/Associations/V4/Model/AssociationSpec.php +++ b/codegen/Crm/Associations/V4/Model/AssociationSpec.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/AssociationSpecWithLabel.php b/codegen/Crm/Associations/V4/Model/AssociationSpecWithLabel.php index 2bfcd7fd6..f54d038f4 100644 --- a/codegen/Crm/Associations/V4/Model/AssociationSpecWithLabel.php +++ b/codegen/Crm/Associations/V4/Model/AssociationSpecWithLabel.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -268,10 +268,10 @@ public function getCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type_id', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php index f2450d6c3..d3e3305a7 100644 --- a/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiArchive.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php index 18ee1ab09..d74d3f4b8 100644 --- a/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicAssociationMultiPost.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php index 991e2379e..2face534b 100644 --- a/codegen/Crm/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicDefaultAssociationMultiPost.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php b/codegen/Crm/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php index c7dc803e2..cb7bdbf08 100644 --- a/codegen/Crm/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php +++ b/codegen/Crm/Associations/V4/Model/BatchInputPublicFetchAssociationsBatchRequest.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php index 209e49709..56bdc8bc6 100644 --- a/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php +++ b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPair.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php index fc584bbdd..6f4cb1391 100644 --- a/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php +++ b/codegen/Crm/Associations/V4/Model/BatchResponseLabelsBetweenObjectPairWithErrors.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php index 6ffbd5c6b..bc8d58bac 100644 --- a/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php +++ b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabel.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php index b16a91b91..cd59ffd61 100644 --- a/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php +++ b/codegen/Crm/Associations/V4/Model/BatchResponsePublicAssociationMultiWithLabelWithErrors.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php b/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php index bd22221f5..0766d5f5a 100644 --- a/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php +++ b/codegen/Crm/Associations/V4/Model/BatchResponsePublicDefaultAssociation.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php b/codegen/Crm/Associations/V4/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php index db47bbefc..a0a37ce92 100644 --- a/codegen/Crm/Associations/V4/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php +++ b/codegen/Crm/Associations/V4/Model/CollectionResponseMultiAssociatedObjectWithLabelForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/DateTime.php b/codegen/Crm/Associations/V4/Model/DateTime.php index 55d7da1fd..4d3c0b3f1 100644 --- a/codegen/Crm/Associations/V4/Model/DateTime.php +++ b/codegen/Crm/Associations/V4/Model/DateTime.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('date_only', $data ?? [], null); $this->setIfExists('time_zone_shift', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/Error.php b/codegen/Crm/Associations/V4/Model/Error.php index d6168e7c6..55cdaafc2 100644 --- a/codegen/Crm/Associations/V4/Model/Error.php +++ b/codegen/Crm/Associations/V4/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/ErrorDetail.php b/codegen/Crm/Associations/V4/Model/ErrorDetail.php index 788d966b3..af903c668 100644 --- a/codegen/Crm/Associations/V4/Model/ErrorDetail.php +++ b/codegen/Crm/Associations/V4/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/ForwardPaging.php b/codegen/Crm/Associations/V4/Model/ForwardPaging.php index 2d9155723..fded0c7b2 100644 --- a/codegen/Crm/Associations/V4/Model/ForwardPaging.php +++ b/codegen/Crm/Associations/V4/Model/ForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Associations/V4/Model/LabelsBetweenObjectPair.php b/codegen/Crm/Associations/V4/Model/LabelsBetweenObjectPair.php index c16d7e388..b0284b3f4 100644 --- a/codegen/Crm/Associations/V4/Model/LabelsBetweenObjectPair.php +++ b/codegen/Crm/Associations/V4/Model/LabelsBetweenObjectPair.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('from_object_type_id', $data ?? [], null); $this->setIfExists('to_object_id', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/ModelInterface.php b/codegen/Crm/Associations/V4/Model/ModelInterface.php index 2efbdcaaf..9c85d8e8e 100644 --- a/codegen/Crm/Associations/V4/Model/ModelInterface.php +++ b/codegen/Crm/Associations/V4/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php b/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php index 91ed0e199..be55c415e 100644 --- a/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php +++ b/codegen/Crm/Associations/V4/Model/MultiAssociatedObjectWithLabel.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_types', $data ?? [], null); $this->setIfExists('to_object_id', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/NextPage.php b/codegen/Crm/Associations/V4/Model/NextPage.php index 8600e3f27..218828ca0 100644 --- a/codegen/Crm/Associations/V4/Model/NextPage.php +++ b/codegen/Crm/Associations/V4/Model/NextPage.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/Paging.php b/codegen/Crm/Associations/V4/Model/Paging.php index 3f115e1a7..5011eacaf 100644 --- a/codegen/Crm/Associations/V4/Model/Paging.php +++ b/codegen/Crm/Associations/V4/Model/Paging.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PreviousPage.php b/codegen/Crm/Associations/V4/Model/PreviousPage.php index 07880fb5d..a03500d24 100644 --- a/codegen/Crm/Associations/V4/Model/PreviousPage.php +++ b/codegen/Crm/Associations/V4/Model/PreviousPage.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PublicAssociationMultiArchive.php b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiArchive.php index 8bc476f12..74cfc8f1b 100644 --- a/codegen/Crm/Associations/V4/Model/PublicAssociationMultiArchive.php +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiArchive.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('from', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PublicAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiPost.php index f77859da5..2219b165c 100644 --- a/codegen/Crm/Associations/V4/Model/PublicAssociationMultiPost.php +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiPost.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('from', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PublicAssociationMultiWithLabel.php b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiWithLabel.php index f8d9cf4e3..16466d4b9 100644 --- a/codegen/Crm/Associations/V4/Model/PublicAssociationMultiWithLabel.php +++ b/codegen/Crm/Associations/V4/Model/PublicAssociationMultiWithLabel.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('from', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php index c592c1d39..1383e9dee 100644 --- a/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php +++ b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociation.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_spec', $data ?? [], null); $this->setIfExists('from', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PublicDefaultAssociationMultiPost.php b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociationMultiPost.php index 0843ff805..ba3e92d8a 100644 --- a/codegen/Crm/Associations/V4/Model/PublicDefaultAssociationMultiPost.php +++ b/codegen/Crm/Associations/V4/Model/PublicDefaultAssociationMultiPost.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('from', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php b/codegen/Crm/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php index 33bfcb30a..0dedbc733 100644 --- a/codegen/Crm/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php +++ b/codegen/Crm/Associations/V4/Model/PublicFetchAssociationsBatchRequest.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/PublicObjectId.php b/codegen/Crm/Associations/V4/Model/PublicObjectId.php index 1d25e743f..8a6939098 100644 --- a/codegen/Crm/Associations/V4/Model/PublicObjectId.php +++ b/codegen/Crm/Associations/V4/Model/PublicObjectId.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Associations/V4/Model/ReportCreationResponse.php b/codegen/Crm/Associations/V4/Model/ReportCreationResponse.php index bbb0c07fd..6282fa208 100644 --- a/codegen/Crm/Associations/V4/Model/ReportCreationResponse.php +++ b/codegen/Crm/Associations/V4/Model/ReportCreationResponse.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('user_email', $data ?? [], null); $this->setIfExists('user_id', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Model/StandardError.php b/codegen/Crm/Associations/V4/Model/StandardError.php index 37db02108..31f06469a 100644 --- a/codegen/Crm/Associations/V4/Model/StandardError.php +++ b/codegen/Crm/Associations/V4/Model/StandardError.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/ObjectSerializer.php b/codegen/Crm/Associations/V4/ObjectSerializer.php index c2a5dee08..af79a1404 100644 --- a/codegen/Crm/Associations/V4/ObjectSerializer.php +++ b/codegen/Crm/Associations/V4/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * CRM Associations + * Associations * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Associations/V4/Schema/Api/DefinitionConfigurationsApi.php b/codegen/Crm/Associations/V4/Schema/Api/DefinitionConfigurationsApi.php new file mode 100644 index 000000000..5a912d0a3 --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Api/DefinitionConfigurationsApi.php @@ -0,0 +1,1959 @@ + [ + 'application/json', + ], + 'batchRemove' => [ + 'application/json', + ], + 'batchUpdate' => [ + 'application/json', + ], + 'getAll' => [ + 'application/json', + ], + 'getAllBetweenTwoObjectTypes' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation batchCreate + * + * Create + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationCreateRequest $batch_input_public_association_definition_configuration_create_request batch_input_public_association_definition_configuration_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchCreate'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration|\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error + */ + public function batchCreate($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, string $contentType = self::contentTypes['batchCreate'][0]) + { + list($response) = $this->batchCreateWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, $contentType); + return $response; + } + + /** + * Operation batchCreateWithHttpInfo + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationCreateRequest $batch_input_public_association_definition_configuration_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchCreate'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration|\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function batchCreateWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, string $contentType = self::contentTypes['batchCreate'][0]) + { + $request = $this->batchCreateRequest($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, $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 201: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration' !== '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\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors' !== '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\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\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\Associations\V4\Schema\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation batchCreateAsync + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationCreateRequest $batch_input_public_association_definition_configuration_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchCreateAsync($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, string $contentType = self::contentTypes['batchCreate'][0]) + { + return $this->batchCreateAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation batchCreateAsyncWithHttpInfo + * + * Create + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationCreateRequest $batch_input_public_association_definition_configuration_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchCreateAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, string $contentType = self::contentTypes['batchCreate'][0]) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionUserConfiguration'; + $request = $this->batchCreateRequest($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, $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 'batchCreate' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationCreateRequest $batch_input_public_association_definition_configuration_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchCreate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function batchCreateRequest($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_create_request, string $contentType = self::contentTypes['batchCreate'][0]) + { + + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling batchCreate' + ); + } + + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling batchCreate' + ); + } + + // verify the required parameter 'batch_input_public_association_definition_configuration_create_request' is set + if ($batch_input_public_association_definition_configuration_create_request === null || (is_array($batch_input_public_association_definition_configuration_create_request) && count($batch_input_public_association_definition_configuration_create_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_association_definition_configuration_create_request when calling batchCreate' + ); + } + + + $resourcePath = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}/batch/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_public_association_definition_configuration_create_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_definition_configuration_create_request)); + } else { + $httpBody = $batch_input_public_association_definition_configuration_create_request; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation batchRemove + * + * Delete + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationSpec $batch_input_public_association_spec batch_input_public_association_spec (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRemove'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function batchRemove($from_object_type, $to_object_type, $batch_input_public_association_spec, string $contentType = self::contentTypes['batchRemove'][0]) + { + $this->batchRemoveWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_spec, $contentType); + } + + /** + * Operation batchRemoveWithHttpInfo + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationSpec $batch_input_public_association_spec (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRemove'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function batchRemoveWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_spec, string $contentType = self::contentTypes['batchRemove'][0]) + { + $request = $this->batchRemoveRequest($from_object_type, $to_object_type, $batch_input_public_association_spec, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation batchRemoveAsync + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationSpec $batch_input_public_association_spec (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchRemoveAsync($from_object_type, $to_object_type, $batch_input_public_association_spec, string $contentType = self::contentTypes['batchRemove'][0]) + { + return $this->batchRemoveAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_spec, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation batchRemoveAsyncWithHttpInfo + * + * Delete + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationSpec $batch_input_public_association_spec (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchRemoveAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_spec, string $contentType = self::contentTypes['batchRemove'][0]) + { + $returnType = ''; + $request = $this->batchRemoveRequest($from_object_type, $to_object_type, $batch_input_public_association_spec, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'batchRemove' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationSpec $batch_input_public_association_spec (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function batchRemoveRequest($from_object_type, $to_object_type, $batch_input_public_association_spec, string $contentType = self::contentTypes['batchRemove'][0]) + { + + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling batchRemove' + ); + } + + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling batchRemove' + ); + } + + // verify the required parameter 'batch_input_public_association_spec' is set + if ($batch_input_public_association_spec === null || (is_array($batch_input_public_association_spec) && count($batch_input_public_association_spec) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_association_spec when calling batchRemove' + ); + } + + + $resourcePath = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}/batch/purge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_public_association_spec)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_spec)); + } else { + $httpBody = $batch_input_public_association_spec; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation batchUpdate + * + * Update + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationUpdateRequest $batch_input_public_association_definition_configuration_update_request batch_input_public_association_definition_configuration_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpdate'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult|\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error + */ + public function batchUpdate($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, string $contentType = self::contentTypes['batchUpdate'][0]) + { + list($response) = $this->batchUpdateWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, $contentType); + return $response; + } + + /** + * Operation batchUpdateWithHttpInfo + * + * Update + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationUpdateRequest $batch_input_public_association_definition_configuration_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpdate'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult|\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function batchUpdateWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, string $contentType = self::contentTypes['batchUpdate'][0]) + { + $request = $this->batchUpdateRequest($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, $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: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult' !== '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\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors' !== '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\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\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\Associations\V4\Schema\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation batchUpdateAsync + * + * Update + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationUpdateRequest $batch_input_public_association_definition_configuration_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchUpdateAsync($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, string $contentType = self::contentTypes['batchUpdate'][0]) + { + return $this->batchUpdateAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation batchUpdateAsyncWithHttpInfo + * + * Update + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationUpdateRequest $batch_input_public_association_definition_configuration_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function batchUpdateAsyncWithHttpInfo($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, string $contentType = self::contentTypes['batchUpdate'][0]) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchResponsePublicAssociationDefinitionConfigurationUpdateResult'; + $request = $this->batchUpdateRequest($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, $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 'batchUpdate' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\BatchInputPublicAssociationDefinitionConfigurationUpdateRequest $batch_input_public_association_definition_configuration_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function batchUpdateRequest($from_object_type, $to_object_type, $batch_input_public_association_definition_configuration_update_request, string $contentType = self::contentTypes['batchUpdate'][0]) + { + + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling batchUpdate' + ); + } + + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling batchUpdate' + ); + } + + // verify the required parameter 'batch_input_public_association_definition_configuration_update_request' is set + if ($batch_input_public_association_definition_configuration_update_request === null || (is_array($batch_input_public_association_definition_configuration_update_request) && count($batch_input_public_association_definition_configuration_update_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_public_association_definition_configuration_update_request when calling batchUpdate' + ); + } + + + $resourcePath = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}/batch/update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_public_association_definition_configuration_update_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_public_association_definition_configuration_update_request)); + } else { + $httpBody = $batch_input_public_association_definition_configuration_update_request; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAll + * + * Read All + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error + */ + public function getAll(string $contentType = self::contentTypes['getAll'][0]) + { + list($response) = $this->getAllWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getAllWithHttpInfo + * + * Read All + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllWithHttpInfo(string $contentType = self::contentTypes['getAll'][0]) + { + $request = $this->getAllRequest($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: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging' !== '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\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\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\Associations\V4\Schema\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllAsync + * + * Read All + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAsync(string $contentType = self::contentTypes['getAll'][0]) + { + return $this->getAllAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllAsyncWithHttpInfo + * + * Read All + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllAsyncWithHttpInfo(string $contentType = self::contentTypes['getAll'][0]) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging'; + $request = $this->getAllRequest($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 'getAll' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllRequest(string $contentType = self::contentTypes['getAll'][0]) + { + + + $resourcePath = '/crm/v4/associations/definitions/configurations/all'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $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 + ); + } + + /** + * Operation getAllBetweenTwoObjectTypes + * + * Read + * + * @param string $from_object_type from_object_type (required) + * @param string $to_object_type to_object_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllBetweenTwoObjectTypes'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error + */ + public function getAllBetweenTwoObjectTypes($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAllBetweenTwoObjectTypes'][0]) + { + list($response) = $this->getAllBetweenTwoObjectTypesWithHttpInfo($from_object_type, $to_object_type, $contentType); + return $response; + } + + /** + * Operation getAllBetweenTwoObjectTypesWithHttpInfo + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllBetweenTwoObjectTypes'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getAllBetweenTwoObjectTypesWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAllBetweenTwoObjectTypes'][0]) + { + $request = $this->getAllBetweenTwoObjectTypesRequest($from_object_type, $to_object_type, $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: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging' !== '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\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\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\Associations\V4\Schema\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAllBetweenTwoObjectTypesAsync + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllBetweenTwoObjectTypes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllBetweenTwoObjectTypesAsync($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAllBetweenTwoObjectTypes'][0]) + { + return $this->getAllBetweenTwoObjectTypesAsyncWithHttpInfo($from_object_type, $to_object_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAllBetweenTwoObjectTypesAsyncWithHttpInfo + * + * Read + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllBetweenTwoObjectTypes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAllBetweenTwoObjectTypesAsyncWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAllBetweenTwoObjectTypes'][0]) + { + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging'; + $request = $this->getAllBetweenTwoObjectTypesRequest($from_object_type, $to_object_type, $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 'getAllBetweenTwoObjectTypes' + * + * @param string $from_object_type (required) + * @param string $to_object_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllBetweenTwoObjectTypes'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAllBetweenTwoObjectTypesRequest($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAllBetweenTwoObjectTypes'][0]) + { + + // verify the required parameter 'from_object_type' is set + if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from_object_type when calling getAllBetweenTwoObjectTypes' + ); + } + + // verify the required parameter 'to_object_type' is set + if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to_object_type when calling getAllBetweenTwoObjectTypes' + ); + } + + + $resourcePath = '/crm/v4/associations/definitions/configurations/{fromObjectType}/{toObjectType}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($from_object_type !== null) { + $resourcePath = str_replace( + '{' . 'fromObjectType' . '}', + ObjectSerializer::toPathValue($from_object_type), + $resourcePath + ); + } + // path params + if ($to_object_type !== null) { + $resourcePath = str_replace( + '{' . 'toObjectType' . '}', + ObjectSerializer::toPathValue($to_object_type), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $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 + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php b/codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php index bc5923425..f94bce018 100644 --- a/codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php +++ b/codegen/Crm/Associations/V4/Schema/Api/DefinitionsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -71,15 +71,15 @@ class DefinitionsApi /** @var string[] $contentTypes **/ public const contentTypes = [ - 'archive' => [ - 'application/json', - ], 'create' => [ 'application/json', ], 'getAll' => [ 'application/json', ], + 'remove' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -92,13 +92,13 @@ class DefinitionsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -132,41 +132,42 @@ public function getConfig() } /** - * Operation archive + * Operation create * - * Delete + * Create * * @param string $from_object_type from_object_type (required) * @param string $to_object_type to_object_type (required) - * @param int $association_type_id association_type_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request public_association_definition_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error */ - public function archive($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['archive'][0]) + public function create($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) { - $this->archiveWithHttpInfo($from_object_type, $to_object_type, $association_type_id, $contentType); + list($response) = $this->createWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType); + return $response; } /** - * Operation archiveWithHttpInfo + * Operation createWithHttpInfo * - * Delete + * Create * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param int $association_type_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['archive'][0]) + public function createWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) { - $request = $this->archiveRequest($from_object_type, $to_object_type, $association_type_id, $contentType); + $request = $this->createRequest($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -190,6 +191,64 @@ public function archiveWithHttpInfo($from_object_type, $to_object_type, $associa $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging' !== '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\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Associations\V4\Schema\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\Associations\V4\Schema\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -203,10 +262,44 @@ public function archiveWithHttpInfo($from_object_type, $to_object_type, $associa ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; + 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() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -221,21 +314,21 @@ public function archiveWithHttpInfo($from_object_type, $to_object_type, $associa } /** - * Operation archiveAsync + * Operation createAsync * - * Delete + * Create * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param int $association_type_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['archive'][0]) + public function createAsync($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) { - return $this->archiveAsyncWithHttpInfo($from_object_type, $to_object_type, $association_type_id, $contentType) + return $this->createAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -244,28 +337,41 @@ function ($response) { } /** - * Operation archiveAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Delete + * Create * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param int $association_type_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['archive'][0]) + public function createAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) { - $returnType = ''; - $request = $this->archiveRequest($from_object_type, $to_object_type, $association_type_id, $contentType); + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; + $request = $this->createRequest($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -285,42 +391,42 @@ function ($exception) { } /** - * Create request for operation 'archive' + * Create request for operation 'create' * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param int $association_type_id (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['archive'][0]) + public function createRequest($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) { // verify the required parameter 'from_object_type' is set if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $from_object_type when calling archive' + 'Missing the required parameter $from_object_type when calling create' ); } // verify the required parameter 'to_object_type' is set if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $to_object_type when calling archive' + 'Missing the required parameter $to_object_type when calling create' ); } - // verify the required parameter 'association_type_id' is set - if ($association_type_id === null || (is_array($association_type_id) && count($association_type_id) === 0)) { + // verify the required parameter 'public_association_definition_create_request' is set + if ($public_association_definition_create_request === null || (is_array($public_association_definition_create_request) && count($public_association_definition_create_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $association_type_id when calling archive' + 'Missing the required parameter $public_association_definition_create_request when calling create' ); } - $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels/{associationTypeId}'; + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels'; $formParams = []; $queryParams = []; $headerParams = []; @@ -345,24 +451,23 @@ public function archiveRequest($from_object_type, $to_object_type, $association_ $resourcePath ); } - // path params - if ($association_type_id !== null) { - $resourcePath = str_replace( - '{' . 'associationTypeId' . '}', - ObjectSerializer::toPathValue($association_type_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($public_association_definition_create_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_association_definition_create_request)); + } else { + $httpBody = $public_association_definition_create_request; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -405,7 +510,7 @@ public function archiveRequest($from_object_type, $to_object_type, $association_ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -413,42 +518,40 @@ public function archiveRequest($from_object_type, $to_object_type, $association_ } /** - * Operation create + * Operation getAll * - * Create + * Read * * @param string $from_object_type from_object_type (required) * @param string $to_object_type to_object_type (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request public_association_definition_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error */ - public function create($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) + public function getAll($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) { - list($response) = $this->createWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType); + list($response) = $this->getAllWithHttpInfo($from_object_type, $to_object_type, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation getAllWithHttpInfo * - * Create + * Read * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) + public function getAllWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) { - $request = $this->createRequest($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType); + $request = $this->getAllRequest($from_object_type, $to_object_type, $contentType); try { $options = $this->createHttpClientOption(); @@ -472,18 +575,6 @@ public function createWithHttpInfo($from_object_type, $to_object_type, $public_a $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -542,6 +633,19 @@ public function createWithHttpInfo($from_object_type, $to_object_type, $public_a ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -594,21 +698,20 @@ public function createWithHttpInfo($from_object_type, $to_object_type, $public_a } /** - * Operation createAsync + * Operation getAllAsync * - * Create + * Read * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) + public function getAllAsync($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) { - return $this->createAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType) + return $this->getAllAsyncWithHttpInfo($from_object_type, $to_object_type, $contentType) ->then( function ($response) { return $response[0]; @@ -617,22 +720,21 @@ function ($response) { } /** - * Operation createAsyncWithHttpInfo + * Operation getAllAsyncWithHttpInfo * - * Create + * Read * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) + public function getAllAsyncWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) { $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; - $request = $this->createRequest($from_object_type, $to_object_type, $public_association_definition_create_request, $contentType); + $request = $this->getAllRequest($from_object_type, $to_object_type, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -671,37 +773,29 @@ function ($exception) { } /** - * Create request for operation 'create' + * Create request for operation 'getAll' * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionCreateRequest $public_association_definition_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($from_object_type, $to_object_type, $public_association_definition_create_request, string $contentType = self::contentTypes['create'][0]) + public function getAllRequest($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) { // verify the required parameter 'from_object_type' is set if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $from_object_type when calling create' + 'Missing the required parameter $from_object_type when calling getAll' ); } // verify the required parameter 'to_object_type' is set if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $to_object_type when calling create' - ); - } - - // verify the required parameter 'public_association_definition_create_request' is set - if ($public_association_definition_create_request === null || (is_array($public_association_definition_create_request) && count($public_association_definition_create_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_association_definition_create_request when calling create' + 'Missing the required parameter $to_object_type when calling getAll' ); } @@ -740,14 +834,7 @@ public function createRequest($from_object_type, $to_object_type, $public_associ ); // for model (json/xml) - if (isset($public_association_definition_create_request)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_association_definition_create_request)); - } else { - $httpBody = $public_association_definition_create_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -790,7 +877,7 @@ public function createRequest($from_object_type, $to_object_type, $public_associ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -798,40 +885,41 @@ public function createRequest($from_object_type, $to_object_type, $public_associ } /** - * Operation getAll + * Operation remove * - * Read + * Delete * * @param string $from_object_type from_object_type (required) * @param string $to_object_type to_object_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $association_type_id association_type_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error + * @return void */ - public function getAll($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) + public function remove($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['remove'][0]) { - list($response) = $this->getAllWithHttpInfo($from_object_type, $to_object_type, $contentType); - return $response; + $this->removeWithHttpInfo($from_object_type, $to_object_type, $association_type_id, $contentType); } /** - * Operation getAllWithHttpInfo + * Operation removeWithHttpInfo * - * Read + * Delete * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $association_type_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Associations\V4\Schema\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging|\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function getAllWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) + public function removeWithHttpInfo($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['remove'][0]) { - $request = $this->getAllRequest($from_object_type, $to_object_type, $contentType); + $request = $this->removeRequest($from_object_type, $to_object_type, $association_type_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -855,114 +943,11 @@ public function getAllWithHttpInfo($from_object_type, $to_object_type, string $c $statusCode = $response->getStatusCode(); - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging' !== '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\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Associations\V4\Schema\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Associations\V4\Schema\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\Associations\V4\Schema\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; - 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 [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -977,20 +962,21 @@ public function getAllWithHttpInfo($from_object_type, $to_object_type, string $c } /** - * Operation getAllAsync + * Operation removeAsync * - * Read + * Delete * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $association_type_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAllAsync($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) + public function removeAsync($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['remove'][0]) { - return $this->getAllAsyncWithHttpInfo($from_object_type, $to_object_type, $contentType) + return $this->removeAsyncWithHttpInfo($from_object_type, $to_object_type, $association_type_id, $contentType) ->then( function ($response) { return $response[0]; @@ -999,40 +985,28 @@ function ($response) { } /** - * Operation getAllAsyncWithHttpInfo + * Operation removeAsyncWithHttpInfo * - * Read + * Delete * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $association_type_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAllAsyncWithHttpInfo($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) + public function removeAsyncWithHttpInfo($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['remove'][0]) { - $returnType = '\HubSpot\Client\Crm\Associations\V4\Schema\Model\CollectionResponseAssociationSpecWithLabelNoPaging'; - $request = $this->getAllRequest($from_object_type, $to_object_type, $contentType); + $returnType = ''; + $request = $this->removeRequest($from_object_type, $to_object_type, $association_type_id, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -1052,34 +1026,42 @@ function ($exception) { } /** - * Create request for operation 'getAll' + * Create request for operation 'remove' * * @param string $from_object_type (required) * @param string $to_object_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation + * @param int $association_type_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getAllRequest($from_object_type, $to_object_type, string $contentType = self::contentTypes['getAll'][0]) + public function removeRequest($from_object_type, $to_object_type, $association_type_id, string $contentType = self::contentTypes['remove'][0]) { // verify the required parameter 'from_object_type' is set if ($from_object_type === null || (is_array($from_object_type) && count($from_object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $from_object_type when calling getAll' + 'Missing the required parameter $from_object_type when calling remove' ); } // verify the required parameter 'to_object_type' is set if ($to_object_type === null || (is_array($to_object_type) && count($to_object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $to_object_type when calling getAll' + 'Missing the required parameter $to_object_type when calling remove' ); } + // verify the required parameter 'association_type_id' is set + if ($association_type_id === null || (is_array($association_type_id) && count($association_type_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $association_type_id when calling remove' + ); + } - $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels'; + + $resourcePath = '/crm/v4/associations/{fromObjectType}/{toObjectType}/labels/{associationTypeId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1104,10 +1086,18 @@ public function getAllRequest($from_object_type, $to_object_type, string $conten $resourcePath ); } + // path params + if ($association_type_id !== null) { + $resourcePath = str_replace( + '{' . 'associationTypeId' . '}', + ObjectSerializer::toPathValue($association_type_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], + ['*/*', ], $contentType, $multipart ); @@ -1156,7 +1146,7 @@ public function getAllRequest($from_object_type, $to_object_type, string $conten $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1222,18 +1212,6 @@ public function updateWithHttpInfo($from_object_type, $to_object_type, $public_a $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; diff --git a/codegen/Crm/Associations/V4/Schema/ApiException.php b/codegen/Crm/Associations/V4/Schema/ApiException.php index b79f59431..9478127b1 100644 --- a/codegen/Crm/Associations/V4/Schema/ApiException.php +++ b/codegen/Crm/Associations/V4/Schema/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Associations/V4/Schema/Configuration.php b/codegen/Crm/Associations/V4/Schema/Configuration.php index 328b06c2d..0857f2ddb 100644 --- a/codegen/Crm/Associations/V4/Schema/Configuration.php +++ b/codegen/Crm/Associations/V4/Schema/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Associations/V4/Schema/HeaderSelector.php b/codegen/Crm/Associations/V4/Schema/HeaderSelector.php index 5fe209ac4..433c70b9c 100644 --- a/codegen/Crm/Associations/V4/Schema/HeaderSelector.php +++ b/codegen/Crm/Associations/V4/Schema/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Associations/V4/Schema/Model/AssociationSpecWithLabel.php b/codegen/Crm/Associations/V4/Schema/Model/AssociationSpecWithLabel.php index 51f4bc565..625819fd2 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/AssociationSpecWithLabel.php +++ b/codegen/Crm/Associations/V4/Schema/Model/AssociationSpecWithLabel.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -268,10 +268,10 @@ public function getCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type_id', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationDefinitionConfigurationCreateRequest.php b/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationDefinitionConfigurationCreateRequest.php new file mode 100644 index 000000000..c5d8cf4f3 --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationDefinitionConfigurationCreateRequest.php @@ -0,0 +1,412 @@ + + */ +class BatchInputPublicAssociationDefinitionConfigurationCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicAssociationDefinitionConfigurationCreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationCreateRequest[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationCreateRequest[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationCreateRequest[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationDefinitionConfigurationUpdateRequest.php b/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationDefinitionConfigurationUpdateRequest.php new file mode 100644 index 000000000..3710d0421 --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationDefinitionConfigurationUpdateRequest.php @@ -0,0 +1,412 @@ + + */ +class BatchInputPublicAssociationDefinitionConfigurationUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicAssociationDefinitionConfigurationUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateRequest[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateRequest[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateRequest[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationSpec.php b/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationSpec.php new file mode 100644 index 000000000..7562adeee --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/BatchInputPublicAssociationSpec.php @@ -0,0 +1,412 @@ + + */ +class BatchInputPublicAssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputPublicAssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationSpec[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationSpec[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationSpec[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionConfigurationUpdateResult.php b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionConfigurationUpdateResult.php new file mode 100644 index 000000000..7f01f8bcd --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionConfigurationUpdateResult.php @@ -0,0 +1,629 @@ + + */ +class BatchResponsePublicAssociationDefinitionConfigurationUpdateResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponsePublicAssociationDefinitionConfigurationUpdateResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateResult[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateResult[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateResult[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors.php b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors.php new file mode 100644 index 000000000..4f286317b --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponsePublicAssociationDefinitionConfigurationUpdateResultWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateResult[]', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateResult[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionConfigurationUpdateResult[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionUserConfiguration.php b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionUserConfiguration.php new file mode 100644 index 000000000..164c855dd --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionUserConfiguration.php @@ -0,0 +1,629 @@ + + */ +class BatchResponsePublicAssociationDefinitionUserConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponsePublicAssociationDefinitionUserConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors.php b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors.php new file mode 100644 index 000000000..c5e39c3dd --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponsePublicAssociationDefinitionUserConfigurationWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[]', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php b/codegen/Crm/Associations/V4/Schema/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php index f123b21ee..6dc5173b4 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php +++ b/codegen/Crm/Associations/V4/Schema/Model/CollectionResponseAssociationSpecWithLabelNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Associations/V4/Schema/Model/CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging.php b/codegen/Crm/Associations/V4/Schema/Model/CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging.php new file mode 100644 index 000000000..bf052031c --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging.php @@ -0,0 +1,412 @@ + + */ +class CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponsePublicAssociationDefinitionUserConfigurationNoPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'results' => 'getResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\PublicAssociationDefinitionUserConfiguration[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/Error.php b/codegen/Crm/Associations/V4/Schema/Model/Error.php index 80cf85303..7febde38a 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/Error.php +++ b/codegen/Crm/Associations/V4/Schema/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Schema/Model/ErrorDetail.php b/codegen/Crm/Associations/V4/Schema/Model/ErrorDetail.php index 69b9a622b..369123ed4 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/ErrorDetail.php +++ b/codegen/Crm/Associations/V4/Schema/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Schema/Model/ModelInterface.php b/codegen/Crm/Associations/V4/Schema/Model/ModelInterface.php index f1b00511c..42b7ace90 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/ModelInterface.php +++ b/codegen/Crm/Associations/V4/Schema/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationCreateRequest.php b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationCreateRequest.php new file mode 100644 index 000000000..a4ed5ceff --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationCreateRequest.php @@ -0,0 +1,522 @@ + + */ +class PublicAssociationDefinitionConfigurationCreateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationDefinitionConfigurationCreateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type_id' => 'int', + 'category' => 'string', + 'max_to_object_ids' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type_id' => 'int32', + 'category' => null, + 'max_to_object_ids' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type_id' => false, + 'category' => false, + 'max_to_object_ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type_id' => 'typeId', + 'category' => 'category', + 'max_to_object_ids' => 'maxToObjectIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type_id' => 'setTypeId', + 'category' => 'setCategory', + 'max_to_object_ids' => 'setMaxToObjectIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type_id' => 'getTypeId', + 'category' => 'getCategory', + 'max_to_object_ids' => 'getMaxToObjectIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type_id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('max_to_object_ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['max_to_object_ids'] === null) { + $invalidProperties[] = "'max_to_object_ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + if (is_null($type_id)) { + throw new \InvalidArgumentException('non-nullable type_id cannot be null'); + } + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets max_to_object_ids + * + * @return int + */ + public function getMaxToObjectIds() + { + return $this->container['max_to_object_ids']; + } + + /** + * Sets max_to_object_ids + * + * @param int $max_to_object_ids max_to_object_ids + * + * @return self + */ + public function setMaxToObjectIds($max_to_object_ids) + { + if (is_null($max_to_object_ids)) { + throw new \InvalidArgumentException('non-nullable max_to_object_ids cannot be null'); + } + $this->container['max_to_object_ids'] = $max_to_object_ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationUpdateRequest.php b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationUpdateRequest.php new file mode 100644 index 000000000..eae4d110f --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationUpdateRequest.php @@ -0,0 +1,522 @@ + + */ +class PublicAssociationDefinitionConfigurationUpdateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationDefinitionConfigurationUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type_id' => 'int', + 'category' => 'string', + 'max_to_object_ids' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type_id' => 'int32', + 'category' => null, + 'max_to_object_ids' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type_id' => false, + 'category' => false, + 'max_to_object_ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type_id' => 'typeId', + 'category' => 'category', + 'max_to_object_ids' => 'maxToObjectIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type_id' => 'setTypeId', + 'category' => 'setCategory', + 'max_to_object_ids' => 'setMaxToObjectIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type_id' => 'getTypeId', + 'category' => 'getCategory', + 'max_to_object_ids' => 'getMaxToObjectIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type_id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('max_to_object_ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['max_to_object_ids'] === null) { + $invalidProperties[] = "'max_to_object_ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + if (is_null($type_id)) { + throw new \InvalidArgumentException('non-nullable type_id cannot be null'); + } + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets max_to_object_ids + * + * @return int + */ + public function getMaxToObjectIds() + { + return $this->container['max_to_object_ids']; + } + + /** + * Sets max_to_object_ids + * + * @param int $max_to_object_ids max_to_object_ids + * + * @return self + */ + public function setMaxToObjectIds($max_to_object_ids) + { + if (is_null($max_to_object_ids)) { + throw new \InvalidArgumentException('non-nullable max_to_object_ids cannot be null'); + } + $this->container['max_to_object_ids'] = $max_to_object_ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationUpdateResult.php b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationUpdateResult.php new file mode 100644 index 000000000..f0914fac5 --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionConfigurationUpdateResult.php @@ -0,0 +1,519 @@ + + */ +class PublicAssociationDefinitionConfigurationUpdateResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationDefinitionConfigurationUpdateResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'user_enforced_max_to_object_ids' => 'int', + 'type_id' => 'int', + 'category' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'user_enforced_max_to_object_ids' => 'int32', + 'type_id' => 'int32', + 'category' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'user_enforced_max_to_object_ids' => false, + 'type_id' => false, + 'category' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'user_enforced_max_to_object_ids' => 'userEnforcedMaxToObjectIds', + 'type_id' => 'typeId', + 'category' => 'category' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'user_enforced_max_to_object_ids' => 'setUserEnforcedMaxToObjectIds', + 'type_id' => 'setTypeId', + 'category' => 'setCategory' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'user_enforced_max_to_object_ids' => 'getUserEnforcedMaxToObjectIds', + 'type_id' => 'getTypeId', + 'category' => 'getCategory' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('user_enforced_max_to_object_ids', $data ?? [], null); + $this->setIfExists('type_id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets user_enforced_max_to_object_ids + * + * @return int|null + */ + public function getUserEnforcedMaxToObjectIds() + { + return $this->container['user_enforced_max_to_object_ids']; + } + + /** + * Sets user_enforced_max_to_object_ids + * + * @param int|null $user_enforced_max_to_object_ids user_enforced_max_to_object_ids + * + * @return self + */ + public function setUserEnforcedMaxToObjectIds($user_enforced_max_to_object_ids) + { + if (is_null($user_enforced_max_to_object_ids)) { + throw new \InvalidArgumentException('non-nullable user_enforced_max_to_object_ids cannot be null'); + } + $this->container['user_enforced_max_to_object_ids'] = $user_enforced_max_to_object_ids; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + if (is_null($type_id)) { + throw new \InvalidArgumentException('non-nullable type_id cannot be null'); + } + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionCreateRequest.php b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionCreateRequest.php index d9271e27d..104adafeb 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionCreateRequest.php +++ b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inverse_label', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionUpdateRequest.php b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionUpdateRequest.php index 46782069a..9c5cb0ba9 100644 --- a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionUpdateRequest.php +++ b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inverse_label', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionUserConfiguration.php b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionUserConfiguration.php new file mode 100644 index 000000000..317314c54 --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationDefinitionUserConfiguration.php @@ -0,0 +1,553 @@ + + */ +class PublicAssociationDefinitionUserConfiguration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationDefinitionUserConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'user_enforced_max_to_object_ids' => 'int', + 'type_id' => 'int', + 'label' => 'string', + 'category' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'user_enforced_max_to_object_ids' => 'int32', + 'type_id' => 'int32', + 'label' => null, + 'category' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'user_enforced_max_to_object_ids' => false, + 'type_id' => false, + 'label' => false, + 'category' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'user_enforced_max_to_object_ids' => 'userEnforcedMaxToObjectIds', + 'type_id' => 'typeId', + 'label' => 'label', + 'category' => 'category' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'user_enforced_max_to_object_ids' => 'setUserEnforcedMaxToObjectIds', + 'type_id' => 'setTypeId', + 'label' => 'setLabel', + 'category' => 'setCategory' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'user_enforced_max_to_object_ids' => 'getUserEnforcedMaxToObjectIds', + 'type_id' => 'getTypeId', + 'label' => 'getLabel', + 'category' => 'getCategory' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCategoryAllowableValues() + { + return [ + self::CATEGORY_HUBSPOT_DEFINED, + self::CATEGORY_USER_DEFINED, + self::CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('user_enforced_max_to_object_ids', $data ?? [], null); + $this->setIfExists('type_id', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'category', must be one of '%s'", + $this->container['category'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets user_enforced_max_to_object_ids + * + * @return int|null + */ + public function getUserEnforcedMaxToObjectIds() + { + return $this->container['user_enforced_max_to_object_ids']; + } + + /** + * Sets user_enforced_max_to_object_ids + * + * @param int|null $user_enforced_max_to_object_ids user_enforced_max_to_object_ids + * + * @return self + */ + public function setUserEnforcedMaxToObjectIds($user_enforced_max_to_object_ids) + { + if (is_null($user_enforced_max_to_object_ids)) { + throw new \InvalidArgumentException('non-nullable user_enforced_max_to_object_ids cannot be null'); + } + $this->container['user_enforced_max_to_object_ids'] = $user_enforced_max_to_object_ids; + + return $this; + } + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + if (is_null($type_id)) { + throw new \InvalidArgumentException('non-nullable type_id cannot be null'); + } + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label label + * + * @return self + */ + public function setLabel($label) + { + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); + } + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'category', must be one of '%s'", + $category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['category'] = $category; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationSpec.php b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationSpec.php new file mode 100644 index 000000000..4a61cf546 --- /dev/null +++ b/codegen/Crm/Associations/V4/Schema/Model/PublicAssociationSpec.php @@ -0,0 +1,449 @@ + + */ +class PublicAssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type_id' => 'int', + 'category' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type_id' => 'int32', + 'category' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type_id' => false, + 'category' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type_id' => 'typeId', + 'category' => 'category' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type_id' => 'setTypeId', + 'category' => 'setCategory' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type_id' => 'getTypeId', + 'category' => 'getCategory' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type_id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type_id'] === null) { + $invalidProperties[] = "'type_id' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type_id + * + * @return int + */ + public function getTypeId() + { + return $this->container['type_id']; + } + + /** + * Sets type_id + * + * @param int $type_id type_id + * + * @return self + */ + public function setTypeId($type_id) + { + if (is_null($type_id)) { + throw new \InvalidArgumentException('non-nullable type_id cannot be null'); + } + $this->container['type_id'] = $type_id; + + return $this; + } + + /** + * Gets category + * + * @return string + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Cms/Performance/Model/Error.php b/codegen/Crm/Associations/V4/Schema/Model/StandardError.php similarity index 79% rename from codegen/Cms/Performance/Model/Error.php rename to codegen/Crm/Associations/V4/Schema/Model/StandardError.php index c09bed04c..95d891819 100644 --- a/codegen/Cms/Performance/Model/Error.php +++ b/codegen/Crm/Associations/V4/Schema/Model/StandardError.php @@ -1,23 +1,23 @@ */ -class Error implements ModelInterface, ArrayAccess, \JsonSerializable +class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'Error'; + protected static $openAPIModelName = 'StandardError'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,13 +57,14 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', + 'sub_category' => 'object', 'context' => 'array', - 'correlation_id' => 'string', 'links' => 'array', - 'message' => 'string', + 'id' => 'string', 'category' => 'string', - 'errors' => '\HubSpot\Client\Cms\Performance\Model\ErrorDetail[]' + 'message' => 'string', + 'errors' => '\HubSpot\Client\Crm\Associations\V4\Schema\Model\ErrorDetail[]', + 'status' => 'string' ]; /** @@ -76,11 +77,12 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'sub_category' => null, 'context' => null, - 'correlation_id' => 'uuid', 'links' => null, - 'message' => null, + 'id' => null, 'category' => null, - 'errors' => null + 'message' => null, + 'errors' => null, + 'status' => null ]; /** @@ -91,11 +93,12 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'sub_category' => false, 'context' => false, - 'correlation_id' => false, 'links' => false, - 'message' => false, + 'id' => false, 'category' => false, - 'errors' => false + 'message' => false, + 'errors' => false, + 'status' => false ]; /** @@ -186,11 +189,12 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'sub_category' => 'subCategory', 'context' => 'context', - 'correlation_id' => 'correlationId', 'links' => 'links', - 'message' => 'message', + 'id' => 'id', 'category' => 'category', - 'errors' => 'errors' + 'message' => 'message', + 'errors' => 'errors', + 'status' => 'status' ]; /** @@ -201,11 +205,12 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'sub_category' => 'setSubCategory', 'context' => 'setContext', - 'correlation_id' => 'setCorrelationId', 'links' => 'setLinks', - 'message' => 'setMessage', + 'id' => 'setId', 'category' => 'setCategory', - 'errors' => 'setErrors' + 'message' => 'setMessage', + 'errors' => 'setErrors', + 'status' => 'setStatus' ]; /** @@ -216,11 +221,12 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'sub_category' => 'getSubCategory', 'context' => 'getContext', - 'correlation_id' => 'getCorrelationId', 'links' => 'getLinks', - 'message' => 'getMessage', + 'id' => 'getId', 'category' => 'getCategory', - 'errors' => 'getErrors' + 'message' => 'getMessage', + 'errors' => 'getErrors', + 'status' => 'getStatus' ]; /** @@ -275,18 +281,19 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); - $this->setIfExists('correlation_id', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); - $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** @@ -316,15 +323,24 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['correlation_id'] === null) { - $invalidProperties[] = "'correlation_id' can't be null"; + if ($this->container['context'] === null) { + $invalidProperties[] = "'context' can't be null"; } - if ($this->container['message'] === null) { - $invalidProperties[] = "'message' can't be null"; + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; } if ($this->container['category'] === null) { $invalidProperties[] = "'category' can't be null"; } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } return $invalidProperties; } @@ -343,7 +359,7 @@ public function valid() /** * Gets sub_category * - * @return string|null + * @return object|null */ public function getSubCategory() { @@ -353,7 +369,7 @@ public function getSubCategory() /** * Sets sub_category * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param object|null $sub_category sub_category * * @return self */ @@ -370,7 +386,7 @@ public function setSubCategory($sub_category) /** * Gets context * - * @return array|null + * @return array */ public function getContext() { @@ -380,7 +396,7 @@ public function getContext() /** * Sets context * - * @param array|null $context Context about the error condition + * @param array $context context * * @return self */ @@ -395,109 +411,109 @@ public function setContext($context) } /** - * Gets correlation_id + * Gets links * - * @return string + * @return array */ - public function getCorrelationId() + public function getLinks() { - return $this->container['correlation_id']; + return $this->container['links']; } /** - * Sets correlation_id + * Sets links * - * @param string $correlation_id A unique identifier for the request. Include this value with any error reports or support tickets + * @param array $links links * * @return self */ - public function setCorrelationId($correlation_id) + public function setLinks($links) { - if (is_null($correlation_id)) { - throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['correlation_id'] = $correlation_id; + $this->container['links'] = $links; return $this; } /** - * Gets links + * Gets id * - * @return array|null + * @return string|null */ - public function getLinks() + public function getId() { - return $this->container['links']; + return $this->container['id']; } /** - * Sets links + * Sets id * - * @param array|null $links A map of link names to associated URIs containing documentation about the error or recommended remediation steps + * @param string|null $id id * * @return self */ - public function setLinks($links) + public function setId($id) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['links'] = $links; + $this->container['id'] = $id; return $this; } /** - * Gets message + * Gets category * * @return string */ - public function getMessage() + public function getCategory() { - return $this->container['message']; + return $this->container['category']; } /** - * Sets message + * Sets category * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param string $category category * * @return self */ - public function setMessage($message) + public function setCategory($category) { - if (is_null($message)) { - throw new \InvalidArgumentException('non-nullable message cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['message'] = $message; + $this->container['category'] = $category; return $this; } /** - * Gets category + * Gets message * * @return string */ - public function getCategory() + public function getMessage() { - return $this->container['category']; + return $this->container['message']; } /** - * Sets category + * Sets message * - * @param string $category The error category + * @param string $message message * * @return self */ - public function setCategory($category) + public function setMessage($message) { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['category'] = $category; + $this->container['message'] = $message; return $this; } @@ -505,7 +521,7 @@ public function setCategory($category) /** * Gets errors * - * @return \HubSpot\Client\Cms\Performance\Model\ErrorDetail[]|null + * @return \HubSpot\Client\Crm\Associations\V4\Schema\Model\ErrorDetail[] */ public function getErrors() { @@ -515,7 +531,7 @@ public function getErrors() /** * Sets errors * - * @param \HubSpot\Client\Cms\Performance\Model\ErrorDetail[]|null $errors further information about the error + * @param \HubSpot\Client\Crm\Associations\V4\Schema\Model\ErrorDetail[] $errors errors * * @return self */ @@ -528,6 +544,33 @@ public function setErrors($errors) return $this; } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Crm/Associations/V4/Schema/ObjectSerializer.php b/codegen/Crm/Associations/V4/Schema/ObjectSerializer.php index 129927289..7a140f89e 100644 --- a/codegen/Crm/Associations/V4/Schema/ObjectSerializer.php +++ b/codegen/Crm/Associations/V4/Schema/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v4 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Companies/Api/BasicApi.php b/codegen/Crm/Companies/Api/BasicApi.php index 84a9ac97f..9137fe938 100644 --- a/codegen/Crm/Companies/Api/BasicApi.php +++ b/codegen/Crm/Companies/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,6 +83,9 @@ class BasicApi 'getPage' => [ 'application/json', ], + 'merge' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -95,13 +98,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,7 +140,7 @@ public function getConfig() /** * Operation archive * - * Archive + * Archive a company * * @param string $company_id company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -154,7 +157,7 @@ public function archive($company_id, string $contentType = self::contentTypes['a /** * Operation archiveWithHttpInfo * - * Archive + * Archive a company * * @param string $company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -189,18 +192,6 @@ public function archiveWithHttpInfo($company_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -222,7 +213,7 @@ public function archiveWithHttpInfo($company_id, string $contentType = self::con /** * Operation archiveAsync * - * Archive + * Archive a company * * @param string $company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -243,7 +234,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive + * Archive a company * * @param string $company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -378,7 +369,7 @@ public function archiveRequest($company_id, string $contentType = self::contentT /** * Operation create * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -396,7 +387,7 @@ public function create($simple_public_object_input_for_create, string $contentTy /** * Operation createWithHttpInfo * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -431,18 +422,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +480,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -555,7 +547,7 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin /** * Operation createAsync * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -576,7 +568,7 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -723,14 +715,14 @@ public function createRequest($simple_public_object_input_for_create, string $co /** * Operation getById * - * Read + * Retrieve a company * - * @param string $company_id company_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -746,14 +738,14 @@ public function getById($company_id, $properties = null, $properties_with_histor /** * Operation getByIdWithHttpInfo * - * Read + * Retrieve a company * - * @param string $company_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +778,6 @@ public function getByIdWithHttpInfo($company_id, $properties = null, $properties $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +836,19 @@ public function getByIdWithHttpInfo($company_id, $properties = null, $properties ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -910,14 +903,14 @@ public function getByIdWithHttpInfo($company_id, $properties = null, $properties /** * Operation getByIdAsync * - * Read + * Retrieve a company * - * @param string $company_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -936,14 +929,14 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Read + * Retrieve a company * - * @param string $company_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,12 +986,12 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $company_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1144,14 +1137,14 @@ public function getByIdRequest($company_id, $properties = null, $properties_with /** * Operation getPage * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -1167,14 +1160,14 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert /** * Operation getPageWithHttpInfo * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1200,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1258,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1331,14 +1325,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu /** * Operation getPageAsync * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1357,14 +1351,14 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1408,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1558,42 +1552,38 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ } /** - * Operation update + * Operation merge * - * Update + * Merge two companies * - * @param string $company_id company_id (required) - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error */ - public function update($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->updateWithHttpInfo($company_id, $simple_public_object_input, $id_property, $contentType); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation mergeWithHttpInfo * - * Update + * Merge two companies * - * @param string $company_id (required) - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->updateRequest($company_id, $simple_public_object_input, $id_property, $contentType); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1617,6 +1607,64 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' !== '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\Companies\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Companies\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Companies\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\Companies\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1630,6 +1678,286 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id ); } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Companies\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two companies + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two companies + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input, $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 'merge' + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + + $resourcePath = '/crm/v3/objects/companies/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a company + * + * @param string $company_id company_id (required) + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error + */ + public function update($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($company_id, $simple_public_object_input, $id_property, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a company + * + * @param string $company_id (required) + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($company_id, $simple_public_object_input, $id_property, $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: if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' === '\SplFileObject') { @@ -1687,6 +2015,19 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1741,11 +2082,11 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id /** * Operation updateAsync * - * Update + * Update a company * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1764,11 +2105,11 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update + * Update a company * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +2161,7 @@ function ($exception) { * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Companies/Api/BatchApi.php b/codegen/Crm/Companies/Api/BatchApi.php index aade2b858..c18b0956c 100644 --- a/codegen/Crm/Companies/Api/BatchApi.php +++ b/codegen/Crm/Companies/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,7 +137,7 @@ public function getConfig() /** * Operation archive * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -154,7 +154,7 @@ public function archive($batch_input_simple_public_object_id, string $contentTyp /** * Operation archiveWithHttpInfo * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -222,7 +210,7 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string /** * Operation archiveAsync * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -243,7 +231,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Companies\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -757,10 +746,10 @@ public function createRequest($batch_input_simple_public_object_input_for_create /** * Operation read * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -776,10 +765,10 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals /** * Operation readWithHttpInfo * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -971,10 +961,10 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc /** * Operation readAsync * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,10 +983,10 @@ function ($response) { /** * Operation readAsyncWithHttpInfo * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1152,7 +1142,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived /** * Operation update * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1170,7 +1160,7 @@ public function update($batch_input_simple_public_object_batch_input, string $co /** * Operation updateWithHttpInfo * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1364,7 +1355,7 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation updateAsync * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1385,7 +1376,7 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Companies/Api/MergeApi.php b/codegen/Crm/Companies/Api/MergeApi.php deleted file mode 100644 index 458d19f1d..000000000 --- a/codegen/Crm/Companies/Api/MergeApi.php +++ /dev/null @@ -1,488 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation merge - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error - */ - public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); - return $response; - } - - /** - * Operation mergeWithHttpInfo - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $request = $this->mergeRequest($public_merge_input, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' !== '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\Companies\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Companies\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Companies\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\Companies\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Companies\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeAsyncWithHttpInfo - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input, $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 'merge' - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - - // verify the required parameter 'public_merge_input' is set - if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_merge_input when calling merge' - ); - } - - - $resourcePath = '/crm/v3/objects/companies/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_merge_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); - } else { - $httpBody = $public_merge_input; - } - } elseif (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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Companies/Api/SearchApi.php b/codegen/Crm/Companies/Api/SearchApi.php index 9346ca736..e3b24edcd 100644 --- a/codegen/Crm/Companies/Api/SearchApi.php +++ b/codegen/Crm/Companies/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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 * diff --git a/codegen/Crm/Companies/ApiException.php b/codegen/Crm/Companies/ApiException.php index 028b11159..0528a4190 100644 --- a/codegen/Crm/Companies/ApiException.php +++ b/codegen/Crm/Companies/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Companies/Configuration.php b/codegen/Crm/Companies/Configuration.php index 14295abcc..73c8b4859 100644 --- a/codegen/Crm/Companies/Configuration.php +++ b/codegen/Crm/Companies/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Companies/HeaderSelector.php b/codegen/Crm/Companies/HeaderSelector.php index bd248b97f..8589ab34c 100644 --- a/codegen/Crm/Companies/HeaderSelector.php +++ b/codegen/Crm/Companies/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Companies/Model/AssociatedId.php b/codegen/Crm/Companies/Model/AssociatedId.php index 6c9377769..77c86c792 100644 --- a/codegen/Crm/Companies/Model/AssociatedId.php +++ b/codegen/Crm/Companies/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/AssociationSpec.php b/codegen/Crm/Companies/Model/AssociationSpec.php index b4195e939..2b6182b83 100644 --- a/codegen/Crm/Companies/Model/AssociationSpec.php +++ b/codegen/Crm/Companies/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); @@ -298,6 +298,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -307,6 +310,9 @@ public function listInvalidProperties() ); } + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } return $invalidProperties; } @@ -325,7 +331,7 @@ public function valid() /** * Gets association_category * - * @return string|null + * @return string */ public function getAssociationCategory() { @@ -335,7 +341,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string|null $association_category association_category + * @param string $association_category For [labeled associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4#associate-records-with-a-label), the category of the association. * * @return self */ @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int|null + * @return int */ public function getAssociationTypeId() { @@ -372,7 +378,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int|null $association_type_id association_type_id + * @param int $association_type_id The [association type ID](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4#association-type-id-values) (e.g., `4` for contact-to-company associations). * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php index eed9bf187..886e16842 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Companies/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index c28e16d38..d742549d4 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 399a836be..1ff245f04 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php index 3e8e071b1..f67266842 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php index 49e55aef0..5fbde3d33 100644 --- a/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php index 7405c0ee9..a3ff31d99 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php index de21f709a..500ce4b87 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php index 1a10382d7..ec491ed29 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 83c111349..748cdb896 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php index c86d3d0d9..6fa4fcd1e 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 45ff00df2..73d8acd54 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index e5d6f8852..d3f0f8c54 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/Error.php b/codegen/Crm/Companies/Model/Error.php index 34263a641..9e425ceb5 100644 --- a/codegen/Crm/Companies/Model/Error.php +++ b/codegen/Crm/Companies/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/ErrorDetail.php b/codegen/Crm/Companies/Model/ErrorDetail.php index a84459957..a921b8c14 100644 --- a/codegen/Crm/Companies/Model/ErrorDetail.php +++ b/codegen/Crm/Companies/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/Filter.php b/codegen/Crm/Companies/Model/Filter.php index a81aa524b..07cec0957 100644 --- a/codegen/Crm/Companies/Model/Filter.php +++ b/codegen/Crm/Companies/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/FilterGroup.php b/codegen/Crm/Companies/Model/FilterGroup.php index 18b165981..b1d7c1425 100644 --- a/codegen/Crm/Companies/Model/FilterGroup.php +++ b/codegen/Crm/Companies/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/ForwardPaging.php b/codegen/Crm/Companies/Model/ForwardPaging.php index 556a12931..5f0507ff1 100644 --- a/codegen/Crm/Companies/Model/ForwardPaging.php +++ b/codegen/Crm/Companies/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/ModelInterface.php b/codegen/Crm/Companies/Model/ModelInterface.php index 0d3f70efd..43560fc27 100644 --- a/codegen/Crm/Companies/Model/ModelInterface.php +++ b/codegen/Crm/Companies/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Companies/Model/NextPage.php b/codegen/Crm/Companies/Model/NextPage.php index e0dcac946..ec20ba6a9 100644 --- a/codegen/Crm/Companies/Model/NextPage.php +++ b/codegen/Crm/Companies/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/Paging.php b/codegen/Crm/Companies/Model/Paging.php index 688d7398f..d89f2dba2 100644 --- a/codegen/Crm/Companies/Model/Paging.php +++ b/codegen/Crm/Companies/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/PreviousPage.php b/codegen/Crm/Companies/Model/PreviousPage.php index c1856f7f9..ff0917394 100644 --- a/codegen/Crm/Companies/Model/PreviousPage.php +++ b/codegen/Crm/Companies/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/PublicAssociationsForObject.php b/codegen/Crm/Companies/Model/PublicAssociationsForObject.php index 3e89e8c13..ead698ea0 100644 --- a/codegen/Crm/Companies/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Companies/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); @@ -281,6 +281,12 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } return $invalidProperties; } @@ -299,7 +305,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Companies\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Companies\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Companies\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Companies\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Companies\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicMergeInput.php b/codegen/Crm/Companies/Model/PublicMergeInput.php index c5ff628ab..8769a2f25 100644 --- a/codegen/Crm/Companies/Model/PublicMergeInput.php +++ b/codegen/Crm/Companies/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_id_to_merge', $data ?? [], null); $this->setIfExists('primary_object_id', $data ?? [], null); @@ -315,7 +315,7 @@ public function getObjectIdToMerge() /** * Sets object_id_to_merge * - * @param string $object_id_to_merge object_id_to_merge + * @param string $object_id_to_merge The ID of the company to merge into the primary. * * @return self */ @@ -342,7 +342,7 @@ public function getPrimaryObjectId() /** * Sets primary_object_id * - * @param string $primary_object_id primary_object_id + * @param string $primary_object_id The ID of the primary company, which the other will merge into. * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicObjectId.php b/codegen/Crm/Companies/Model/PublicObjectId.php index 5f4b7d3e2..facf5c028 100644 --- a/codegen/Crm/Companies/Model/PublicObjectId.php +++ b/codegen/Crm/Companies/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } @@ -274,6 +274,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } return $invalidProperties; } @@ -292,7 +295,7 @@ public function valid() /** * Gets id * - * @return string|null + * @return string */ public function getId() { @@ -302,7 +305,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string $id The ID of the target record to associate. * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php b/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php index 2195bec71..9747b47f1 100644 --- a/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/SimplePublicObject.php b/codegen/Crm/Companies/Model/SimplePublicObject.php index d68c65f74..11c9dbfa5 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObject.php +++ b/codegen/Crm/Companies/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php index 8aed582b3..bda2236c1 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -356,7 +356,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id object_write_trace_id + * @param string|null $object_write_trace_id In each input object, set this field to a unique ID value to enable more granular debugging for error responses. Learn more about [multi-status errors](https://developers.hubspot.com/docs/reference/api/other-resources/error-handling#multi-status-errors). * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The ID to be updated. This can be the object ID, or the unique property value of the `idProperty` property. * * @return self */ @@ -410,7 +410,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..4e1584851 --- /dev/null +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php index 7fcc17cb1..e76573d5a 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -356,7 +356,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id object_write_trace_id + * @param string|null $object_write_trace_id In each input object, set this field to a unique ID value to enable more granular debugging for error responses. Learn more about [multi-status errors](https://developers.hubspot.com/docs/reference/api/other-resources/error-handling#multi-status-errors). * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The ID of the company to update. * * @return self */ @@ -410,7 +410,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectId.php b/codegen/Crm/Companies/Model/SimplePublicObjectId.php index 421b9acc3..63a5a8d39 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php index 54e096d25..5bfe468c5 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * @@ -339,7 +305,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php index f5dcae099..da44b6f9d 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -333,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * @@ -373,7 +339,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php index a778815cc..184fa2641 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php b/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php index e0bd3e59a..696a4eeed 100644 --- a/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/StandardError.php b/codegen/Crm/Companies/Model/StandardError.php index 92ab4563b..615f0d636 100644 --- a/codegen/Crm/Companies/Model/StandardError.php +++ b/codegen/Crm/Companies/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/ValueWithTimestamp.php b/codegen/Crm/Companies/Model/ValueWithTimestamp.php index a2977109f..4359ac8de 100644 --- a/codegen/Crm/Companies/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Companies/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Companies/ObjectSerializer.php b/codegen/Crm/Companies/ObjectSerializer.php index 236e866d3..08d7e8bd0 100644 --- a/codegen/Crm/Companies/ObjectSerializer.php +++ b/codegen/Crm/Companies/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Contacts/Api/BasicApi.php b/codegen/Crm/Contacts/Api/BasicApi.php index 50bbc06c6..4100985a0 100644 --- a/codegen/Crm/Contacts/Api/BasicApi.php +++ b/codegen/Crm/Contacts/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,6 +83,12 @@ class BasicApi 'getPage' => [ 'application/json', ], + 'merge' => [ + 'application/json', + ], + 'purge' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -95,13 +101,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,9 +143,9 @@ public function getConfig() /** * Operation archive * - * Archive + * Archive a contact * - * @param string $contact_id contact_id (required) + * @param string $contact_id The ID of the contact to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -154,9 +160,9 @@ public function archive($contact_id, string $contentType = self::contentTypes['a /** * Operation archiveWithHttpInfo * - * Archive + * Archive a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -189,18 +195,6 @@ public function archiveWithHttpInfo($contact_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -222,9 +216,9 @@ public function archiveWithHttpInfo($contact_id, string $contentType = self::con /** * Operation archiveAsync * - * Archive + * Archive a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -243,9 +237,9 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive + * Archive a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -282,7 +276,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -378,7 +372,7 @@ public function archiveRequest($contact_id, string $contentType = self::contentT /** * Operation create * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -396,7 +390,7 @@ public function create($simple_public_object_input_for_create, string $contentTy /** * Operation createWithHttpInfo * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -431,18 +425,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +483,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -555,7 +550,7 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin /** * Operation createAsync * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -576,7 +571,7 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -723,14 +718,14 @@ public function createRequest($simple_public_object_input_for_create, string $co /** * Operation getById * - * Read + * Retrieve a contact * - * @param string $contact_id contact_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -746,14 +741,14 @@ public function getById($contact_id, $properties = null, $properties_with_histor /** * Operation getByIdWithHttpInfo * - * Read + * Retrieve a contact * - * @param string $contact_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +781,6 @@ public function getByIdWithHttpInfo($contact_id, $properties = null, $properties $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +839,19 @@ public function getByIdWithHttpInfo($contact_id, $properties = null, $properties ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -910,14 +906,14 @@ public function getByIdWithHttpInfo($contact_id, $properties = null, $properties /** * Operation getByIdAsync * - * Read + * Retrieve a contact * - * @param string $contact_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -936,14 +932,14 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Read + * Retrieve a contact * - * @param string $contact_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,12 +989,12 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $contact_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1144,14 +1140,14 @@ public function getByIdRequest($contact_id, $properties = null, $properties_with /** * Operation getPage * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -1167,14 +1163,14 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert /** * Operation getPageWithHttpInfo * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1203,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1261,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1331,14 +1328,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu /** * Operation getPageAsync * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1357,14 +1354,14 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1411,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1558,42 +1555,38 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ } /** - * Operation update + * Operation merge * - * Update + * Merge two contacts * - * @param string $contact_id contact_id (required) - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error */ - public function update($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property, $contentType); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation mergeWithHttpInfo * - * Update + * Merge two contacts * - * @param string $contact_id (required) - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->updateRequest($contact_id, $simple_public_object_input, $id_property, $contentType); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1617,18 +1610,6 @@ public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1668,597 @@ public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id ]; } + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two contacts + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two contacts + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input, $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 'merge' + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + + $resourcePath = '/crm/v3/objects/contacts/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation purge + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); + } + + /** + * Operation purgeWithHttpInfo + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + $request = $this->purgeRequest($public_gdpr_delete_input, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation purgeAsync + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation purgeAsyncWithHttpInfo + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + $returnType = ''; + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'purge' + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + + // verify the required parameter 'public_gdpr_delete_input' is set + if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_gdpr_delete_input when calling purge' + ); + } + + + $resourcePath = '/crm/v3/objects/contacts/gdpr-delete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_gdpr_delete_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + } else { + $httpBody = $public_gdpr_delete_input; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a contact + * + * @param string $contact_id The ID of the contact to update. (required) + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error + */ + public function update($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a contact + * + * @param string $contact_id The ID of the contact to update. (required) + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($contact_id, $simple_public_object_input, $id_property, $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: + if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' !== '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\Contacts\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Contacts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Contacts\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\Contacts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1741,11 +2313,11 @@ public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id /** * Operation updateAsync * - * Update + * Update a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to update. (required) * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1764,11 +2336,11 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update + * Update a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to update. (required) * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1818,9 +2390,9 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to update. (required) * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Contacts/Api/BatchApi.php b/codegen/Crm/Contacts/Api/BatchApi.php index 545e4622f..739144b4c 100644 --- a/codegen/Crm/Contacts/Api/BatchApi.php +++ b/codegen/Crm/Contacts/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,7 +137,7 @@ public function getConfig() /** * Operation archive * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -154,7 +154,7 @@ public function archive($batch_input_simple_public_object_id, string $contentTyp /** * Operation archiveWithHttpInfo * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -222,7 +210,7 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string /** * Operation archiveAsync * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -243,7 +231,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Contacts\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -757,10 +746,10 @@ public function createRequest($batch_input_simple_public_object_input_for_create /** * Operation read * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -776,10 +765,10 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals /** * Operation readWithHttpInfo * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -971,10 +961,10 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc /** * Operation readAsync * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,10 +983,10 @@ function ($response) { /** * Operation readAsyncWithHttpInfo * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1152,7 +1142,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived /** * Operation update * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1170,7 +1160,7 @@ public function update($batch_input_simple_public_object_batch_input, string $co /** * Operation updateWithHttpInfo * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1364,7 +1355,7 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation updateAsync * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1385,7 +1376,7 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation @@ -1532,7 +1523,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str /** * Operation upsert * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation @@ -1550,7 +1541,7 @@ public function upsert($batch_input_simple_public_object_batch_input_upsert, str /** * Operation upsertWithHttpInfo * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1744,7 +1736,7 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation upsertAsync * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation @@ -1765,7 +1757,7 @@ function ($response) { /** * Operation upsertAsyncWithHttpInfo * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation diff --git a/codegen/Crm/Contacts/Api/MergeApi.php b/codegen/Crm/Contacts/Api/MergeApi.php deleted file mode 100644 index b0634af99..000000000 --- a/codegen/Crm/Contacts/Api/MergeApi.php +++ /dev/null @@ -1,488 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation merge - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error - */ - public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); - return $response; - } - - /** - * Operation mergeWithHttpInfo - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $request = $this->mergeRequest($public_merge_input, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' !== '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\Contacts\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Contacts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Contacts\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\Contacts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeAsyncWithHttpInfo - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input, $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 'merge' - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - - // verify the required parameter 'public_merge_input' is set - if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_merge_input when calling merge' - ); - } - - - $resourcePath = '/crm/v3/objects/contacts/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_merge_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); - } else { - $httpBody = $public_merge_input; - } - } elseif (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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Contacts/Api/SearchApi.php b/codegen/Crm/Contacts/Api/SearchApi.php index 82569ee04..259ef812a 100644 --- a/codegen/Crm/Contacts/Api/SearchApi.php +++ b/codegen/Crm/Contacts/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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 * diff --git a/codegen/Crm/Contacts/ApiException.php b/codegen/Crm/Contacts/ApiException.php index 8bbe7208e..88f759608 100644 --- a/codegen/Crm/Contacts/ApiException.php +++ b/codegen/Crm/Contacts/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Contacts/Configuration.php b/codegen/Crm/Contacts/Configuration.php index a5be785fd..8ed9a3952 100644 --- a/codegen/Crm/Contacts/Configuration.php +++ b/codegen/Crm/Contacts/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Contacts/HeaderSelector.php b/codegen/Crm/Contacts/HeaderSelector.php index 54323e397..137b770f1 100644 --- a/codegen/Crm/Contacts/HeaderSelector.php +++ b/codegen/Crm/Contacts/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Contacts/Model/AssociatedId.php b/codegen/Crm/Contacts/Model/AssociatedId.php index e88f0a52c..fc20577a0 100644 --- a/codegen/Crm/Contacts/Model/AssociatedId.php +++ b/codegen/Crm/Contacts/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/AssociationSpec.php b/codegen/Crm/Contacts/Model/AssociationSpec.php index d2f609ff8..3051a702e 100644 --- a/codegen/Crm/Contacts/Model/AssociationSpec.php +++ b/codegen/Crm/Contacts/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); @@ -298,6 +298,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -307,6 +310,9 @@ public function listInvalidProperties() ); } + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } return $invalidProperties; } @@ -325,7 +331,7 @@ public function valid() /** * Gets association_category * - * @return string|null + * @return string */ public function getAssociationCategory() { @@ -335,7 +341,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string|null $association_category association_category + * @param string $association_category association_category * * @return self */ @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int|null + * @return int */ public function getAssociationTypeId() { @@ -372,7 +378,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int|null $association_type_id association_type_id + * @param int $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php index 0b547166d..7536134c7 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index a79b30f12..f63fd8a8f 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 1e37e2acd..a901bf337 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php index e25e628bf..835586eef 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php index dc9bead48..d1c35a8c8 100644 --- a/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php index a8801a0f7..5c446c9f1 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php index 5343c49d9..5eb2fd71b 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php index 712b889e7..2a64fbb5f 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 5fc4f8864..dec55d771 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php index 3ea5f1e35..e56a6d87f 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index e72e6ec0b..65c8e6edf 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index db83f4141..117c58f72 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/Error.php b/codegen/Crm/Contacts/Model/Error.php index 14e173d98..5e9e2e98f 100644 --- a/codegen/Crm/Contacts/Model/Error.php +++ b/codegen/Crm/Contacts/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/ErrorDetail.php b/codegen/Crm/Contacts/Model/ErrorDetail.php index 5a18f46ad..b5f63dceb 100644 --- a/codegen/Crm/Contacts/Model/ErrorDetail.php +++ b/codegen/Crm/Contacts/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/Filter.php b/codegen/Crm/Contacts/Model/Filter.php index 97f09eef9..c81e0ad2c 100644 --- a/codegen/Crm/Contacts/Model/Filter.php +++ b/codegen/Crm/Contacts/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/FilterGroup.php b/codegen/Crm/Contacts/Model/FilterGroup.php index 6962ae63c..855d6d0e5 100644 --- a/codegen/Crm/Contacts/Model/FilterGroup.php +++ b/codegen/Crm/Contacts/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/ForwardPaging.php b/codegen/Crm/Contacts/Model/ForwardPaging.php index 97a8aed0c..0c067eae6 100644 --- a/codegen/Crm/Contacts/Model/ForwardPaging.php +++ b/codegen/Crm/Contacts/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/ModelInterface.php b/codegen/Crm/Contacts/Model/ModelInterface.php index 7d8a45957..d3ccb82de 100644 --- a/codegen/Crm/Contacts/Model/ModelInterface.php +++ b/codegen/Crm/Contacts/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Contacts/Model/NextPage.php b/codegen/Crm/Contacts/Model/NextPage.php index f784c83ee..56b2b19bf 100644 --- a/codegen/Crm/Contacts/Model/NextPage.php +++ b/codegen/Crm/Contacts/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/Paging.php b/codegen/Crm/Contacts/Model/Paging.php index c3b7bca8e..c20a473d5 100644 --- a/codegen/Crm/Contacts/Model/Paging.php +++ b/codegen/Crm/Contacts/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/PreviousPage.php b/codegen/Crm/Contacts/Model/PreviousPage.php index 104ee7f3b..9ef6be71a 100644 --- a/codegen/Crm/Contacts/Model/PreviousPage.php +++ b/codegen/Crm/Contacts/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php b/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php index a3aecce12..a320d2859 100644 --- a/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); @@ -281,6 +281,12 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } return $invalidProperties; } @@ -299,7 +305,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Contacts\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Contacts\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Contacts\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php b/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php index f75f51121..db9fa9541 100644 --- a/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_id', $data ?? [], null); @@ -312,7 +312,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object. An alternative to identifying a contact by ID. * * @return self */ @@ -339,7 +339,7 @@ public function getObjectId() /** * Sets object_id * - * @param string $object_id object_id + * @param string $object_id The ID of the contact to permanently delete. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicMergeInput.php b/codegen/Crm/Contacts/Model/PublicMergeInput.php index 168bb6472..a47e40ce9 100644 --- a/codegen/Crm/Contacts/Model/PublicMergeInput.php +++ b/codegen/Crm/Contacts/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_id_to_merge', $data ?? [], null); $this->setIfExists('primary_object_id', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/PublicObjectId.php b/codegen/Crm/Contacts/Model/PublicObjectId.php index 93e83f08b..76745247d 100644 --- a/codegen/Crm/Contacts/Model/PublicObjectId.php +++ b/codegen/Crm/Contacts/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } @@ -274,6 +274,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } return $invalidProperties; } @@ -292,7 +295,7 @@ public function valid() /** * Gets id * - * @return string|null + * @return string */ public function getId() { @@ -302,7 +305,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string $id id * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php b/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php index 470555fa1..f6eb940b2 100644 --- a/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/SimplePublicObject.php b/codegen/Crm/Contacts/Model/SimplePublicObject.php index c0d2c2953..7e04dd7ff 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObject.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php index 2f900c1f1..5adec3daa 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a unique property, when identifying records by property. * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The ID of the contact to update. This can be the object ID, or the unique property value of the `idProperty` property. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..8010972fb --- /dev/null +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php index 4e73e5e26..e036c1de8 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectId.php b/codegen/Crm/Contacts/Model/SimplePublicObjectId.php index 617e14330..33bb98022 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php index 5cfb7dbf9..437c94260 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php index 2a0b7b78e..e0ddde7fd 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -333,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php index 2d00cb71d..f2981d949 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -417,7 +424,7 @@ public function getArchived() /** * Sets archived * - * @param bool|null $archived archived + * @param bool|null $archived * * @return self */ @@ -444,7 +451,7 @@ public function getArchivedAt() /** * Sets archived_at * - * @param \DateTime|null $archived_at archived_at + * @param \DateTime|null $archived_at * * @return self */ @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * @@ -525,7 +559,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php b/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php index 6373a477b..4c9c42014 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/StandardError.php b/codegen/Crm/Contacts/Model/StandardError.php index cb1182565..89f51c170 100644 --- a/codegen/Crm/Contacts/Model/StandardError.php +++ b/codegen/Crm/Contacts/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/ValueWithTimestamp.php b/codegen/Crm/Contacts/Model/ValueWithTimestamp.php index 41d4f2e11..427fa73a2 100644 --- a/codegen/Crm/Contacts/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Contacts/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Contacts/ObjectSerializer.php b/codegen/Crm/Contacts/ObjectSerializer.php index 340288eab..99bc90be3 100644 --- a/codegen/Crm/Contacts/ObjectSerializer.php +++ b/codegen/Crm/Contacts/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Deals/Api/BasicApi.php b/codegen/Crm/Deals/Api/BasicApi.php index 75ffd8330..5eff7e0c3 100644 --- a/codegen/Crm/Deals/Api/BasicApi.php +++ b/codegen/Crm/Deals/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,6 +83,9 @@ class BasicApi 'getPage' => [ 'application/json', ], + 'merge' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -95,13 +98,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +192,6 @@ public function archiveWithHttpInfo($deal_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +422,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +480,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +718,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $deal_id deal_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +741,11 @@ public function getById($deal_id, $properties = null, $properties_with_history = * Read * * @param string $deal_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +778,6 @@ public function getByIdWithHttpInfo($deal_id, $properties = null, $properties_wi $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +836,19 @@ public function getByIdWithHttpInfo($deal_id, $properties = null, $properties_wi ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +906,11 @@ public function getByIdWithHttpInfo($deal_id, $properties = null, $properties_wi * Read * * @param string $deal_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +932,11 @@ function ($response) { * Read * * @param string $deal_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +987,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $deal_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1139,12 @@ public function getByIdRequest($deal_id, $properties = null, $properties_with_hi * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1162,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1200,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1258,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1327,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1353,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1408,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1557,6 +1551,352 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ ); } + /** + * Operation merge + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error + */ + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); + return $response; + } + + /** + * Operation mergeWithHttpInfo + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $request = $this->mergeRequest($public_merge_input, $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: + if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' !== '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\Deals\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Deals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Deals\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\Deals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Deals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input, $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 'merge' + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + + $resourcePath = '/crm/v3/objects/deals/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation update * @@ -1564,7 +1904,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $deal_id deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1924,7 @@ public function update($deal_id, $simple_public_object_input, $id_property = nul * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1957,6 @@ public function updateWithHttpInfo($deal_id, $simple_public_object_input, $id_pr $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +2015,19 @@ public function updateWithHttpInfo($deal_id, $simple_public_object_input, $id_pr ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +2086,7 @@ public function updateWithHttpInfo($deal_id, $simple_public_object_input, $id_pr * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +2109,7 @@ function ($response) { * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +2161,7 @@ function ($exception) { * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Deals/Api/BatchApi.php b/codegen/Crm/Deals/Api/BatchApi.php index 1e58ad29f..7051dbaa4 100644 --- a/codegen/Crm/Deals/Api/BatchApi.php +++ b/codegen/Crm/Deals/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Deals\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Deals/Api/MergeApi.php b/codegen/Crm/Deals/Api/MergeApi.php deleted file mode 100644 index cc97229cd..000000000 --- a/codegen/Crm/Deals/Api/MergeApi.php +++ /dev/null @@ -1,488 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation merge - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error - */ - public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); - return $response; - } - - /** - * Operation mergeWithHttpInfo - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $request = $this->mergeRequest($public_merge_input, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' !== '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\Deals\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Deals\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Deals\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\Deals\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Deals\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeAsyncWithHttpInfo - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input, $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 'merge' - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - - // verify the required parameter 'public_merge_input' is set - if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_merge_input when calling merge' - ); - } - - - $resourcePath = '/crm/v3/objects/deals/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_merge_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); - } else { - $httpBody = $public_merge_input; - } - } elseif (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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Deals/Api/SearchApi.php b/codegen/Crm/Deals/Api/SearchApi.php index a87ca1d85..731b3e519 100644 --- a/codegen/Crm/Deals/Api/SearchApi.php +++ b/codegen/Crm/Deals/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Deals/ApiException.php b/codegen/Crm/Deals/ApiException.php index f2fc151aa..af6e6ab4a 100644 --- a/codegen/Crm/Deals/ApiException.php +++ b/codegen/Crm/Deals/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Deals/Configuration.php b/codegen/Crm/Deals/Configuration.php index 1b3564157..6f4fbf83f 100644 --- a/codegen/Crm/Deals/Configuration.php +++ b/codegen/Crm/Deals/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Deals/HeaderSelector.php b/codegen/Crm/Deals/HeaderSelector.php index ef0486de0..490304038 100644 --- a/codegen/Crm/Deals/HeaderSelector.php +++ b/codegen/Crm/Deals/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Deals/Model/AssociatedId.php b/codegen/Crm/Deals/Model/AssociatedId.php index 181dc60e6..ba5f109e2 100644 --- a/codegen/Crm/Deals/Model/AssociatedId.php +++ b/codegen/Crm/Deals/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/AssociationSpec.php b/codegen/Crm/Deals/Model/AssociationSpec.php index 59f1d521c..653b30cce 100644 --- a/codegen/Crm/Deals/Model/AssociationSpec.php +++ b/codegen/Crm/Deals/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); @@ -298,6 +298,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -307,6 +310,9 @@ public function listInvalidProperties() ); } + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } return $invalidProperties; } @@ -325,7 +331,7 @@ public function valid() /** * Gets association_category * - * @return string|null + * @return string */ public function getAssociationCategory() { @@ -335,7 +341,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string|null $association_category association_category + * @param string $association_category association_category * * @return self */ @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int|null + * @return int */ public function getAssociationTypeId() { @@ -372,7 +378,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int|null $association_type_id association_type_id + * @param int $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php index c691870b3..4d88ea1c5 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Deals/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index fc9888cae..477b137e3 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 8914f0a6f..4c1442f7d 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php index 09b3696f2..7bbd3b045 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php index c3a95cb2d..ca930afeb 100644 --- a/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php index d6f0d8ea8..48e197542 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php index abda838cf..8024f948c 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php index b6b4c84b0..b72b4cc0d 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 0edd2e58b..5c8224b46 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php index 74342afda..f5e52073a 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 83489077b..924db2c10 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index b75849f42..8c7291707 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/Error.php b/codegen/Crm/Deals/Model/Error.php index d4098ace5..c011f7e1b 100644 --- a/codegen/Crm/Deals/Model/Error.php +++ b/codegen/Crm/Deals/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/ErrorDetail.php b/codegen/Crm/Deals/Model/ErrorDetail.php index 66d28d4a4..79263319c 100644 --- a/codegen/Crm/Deals/Model/ErrorDetail.php +++ b/codegen/Crm/Deals/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/Filter.php b/codegen/Crm/Deals/Model/Filter.php index 5d4565347..2ca89cd2e 100644 --- a/codegen/Crm/Deals/Model/Filter.php +++ b/codegen/Crm/Deals/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/FilterGroup.php b/codegen/Crm/Deals/Model/FilterGroup.php index 2ef054dc0..6290dabb2 100644 --- a/codegen/Crm/Deals/Model/FilterGroup.php +++ b/codegen/Crm/Deals/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/ForwardPaging.php b/codegen/Crm/Deals/Model/ForwardPaging.php index c5f2f6bde..ddd444dfe 100644 --- a/codegen/Crm/Deals/Model/ForwardPaging.php +++ b/codegen/Crm/Deals/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/ModelInterface.php b/codegen/Crm/Deals/Model/ModelInterface.php index 513396fad..b0b84f51d 100644 --- a/codegen/Crm/Deals/Model/ModelInterface.php +++ b/codegen/Crm/Deals/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Deals/Model/NextPage.php b/codegen/Crm/Deals/Model/NextPage.php index 50744c1b5..afec5b37f 100644 --- a/codegen/Crm/Deals/Model/NextPage.php +++ b/codegen/Crm/Deals/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/Paging.php b/codegen/Crm/Deals/Model/Paging.php index 029051a00..b7e85866e 100644 --- a/codegen/Crm/Deals/Model/Paging.php +++ b/codegen/Crm/Deals/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/PreviousPage.php b/codegen/Crm/Deals/Model/PreviousPage.php index da2794f8d..7129bfe72 100644 --- a/codegen/Crm/Deals/Model/PreviousPage.php +++ b/codegen/Crm/Deals/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/PublicAssociationsForObject.php b/codegen/Crm/Deals/Model/PublicAssociationsForObject.php index 51949fc21..03851560d 100644 --- a/codegen/Crm/Deals/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Deals/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); @@ -281,6 +281,12 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } return $invalidProperties; } @@ -299,7 +305,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Deals\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Deals\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Deals\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Deals\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Deals\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Deals/Model/PublicMergeInput.php b/codegen/Crm/Deals/Model/PublicMergeInput.php index cff3e3294..09865548c 100644 --- a/codegen/Crm/Deals/Model/PublicMergeInput.php +++ b/codegen/Crm/Deals/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_id_to_merge', $data ?? [], null); $this->setIfExists('primary_object_id', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/PublicObjectId.php b/codegen/Crm/Deals/Model/PublicObjectId.php index 76e487cc6..0aaa678f5 100644 --- a/codegen/Crm/Deals/Model/PublicObjectId.php +++ b/codegen/Crm/Deals/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } @@ -274,6 +274,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } return $invalidProperties; } @@ -292,7 +295,7 @@ public function valid() /** * Gets id * - * @return string|null + * @return string */ public function getId() { @@ -302,7 +305,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string $id id * * @return self */ diff --git a/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php b/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php index 0251d13dd..580843957 100644 --- a/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/SimplePublicObject.php b/codegen/Crm/Deals/Model/SimplePublicObject.php index a1b9b705f..314c1c5d9 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObject.php +++ b/codegen/Crm/Deals/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php index c20d09603..5cdf6f9be 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..8593abb31 --- /dev/null +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php index 41103472f..74aa5ceb7 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectId.php b/codegen/Crm/Deals/Model/SimplePublicObjectId.php index e9369952a..646ace610 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php index 68034dc1a..d55d7a7b9 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php index 803bfebf6..ff6183c7f 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -333,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php index 496d7aa54..31ee04245 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php b/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php index 927175ea4..40f3c24dd 100644 --- a/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/StandardError.php b/codegen/Crm/Deals/Model/StandardError.php index 5ec3112b3..35dfcc0e1 100644 --- a/codegen/Crm/Deals/Model/StandardError.php +++ b/codegen/Crm/Deals/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/ValueWithTimestamp.php b/codegen/Crm/Deals/Model/ValueWithTimestamp.php index ca1bfc21c..c42b4042d 100644 --- a/codegen/Crm/Deals/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Deals/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Deals/ObjectSerializer.php b/codegen/Crm/Deals/ObjectSerializer.php index f7efa4fef..d9390c41c 100644 --- a/codegen/Crm/Deals/ObjectSerializer.php +++ b/codegen/Crm/Deals/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php b/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php new file mode 100644 index 000000000..1882abef0 --- /dev/null +++ b/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php @@ -0,0 +1,1464 @@ + [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation archive + * + * Delete channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archive($app_id, string $contentType = self::contentTypes['archive'][0]) + { + $this->archiveWithHttpInfo($app_id, $contentType); + } + + /** + * Operation archiveWithHttpInfo + * + * Delete channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($app_id, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($app_id, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($app_id, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($app_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($app_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'archive' + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($app_id, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling archive' + ); + } + + + $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/channel-connection'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'appId' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Configure channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error + */ + public function create($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($app_id, $channel_connection_settings_request, $contentType); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Configure channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($app_id, $channel_connection_settings_request, $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: + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' !== '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\Extensions\Calling\Model\ChannelConnectionSettingsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Extensions\Calling\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\Extensions\Calling\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Configure channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + { + return $this->createAsyncWithHttpInfo($app_id, $channel_connection_settings_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Configure channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + { + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; + $request = $this->createRequest($app_id, $channel_connection_settings_request, $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 'create' + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + { + + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling create' + ); + } + + // verify the required parameter 'channel_connection_settings_request' is set + if ($channel_connection_settings_request === null || (is_array($channel_connection_settings_request) && count($channel_connection_settings_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $channel_connection_settings_request when calling create' + ); + } + + + $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/channel-connection'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'appId' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($channel_connection_settings_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_request)); + } else { + $httpBody = $channel_connection_settings_request; + } + } elseif (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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + + $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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getById + * + * Retrieve channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error + */ + public function getById($app_id, string $contentType = self::contentTypes['getById'][0]) + { + list($response) = $this->getByIdWithHttpInfo($app_id, $contentType); + return $response; + } + + /** + * Operation getByIdWithHttpInfo + * + * Retrieve channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getByIdWithHttpInfo($app_id, string $contentType = self::contentTypes['getById'][0]) + { + $request = $this->getByIdRequest($app_id, $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: + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' !== '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\Extensions\Calling\Model\ChannelConnectionSettingsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Extensions\Calling\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\Extensions\Calling\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getByIdAsync + * + * Retrieve channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsync($app_id, string $contentType = self::contentTypes['getById'][0]) + { + return $this->getByIdAsyncWithHttpInfo($app_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getByIdAsyncWithHttpInfo + * + * Retrieve channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['getById'][0]) + { + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; + $request = $this->getByIdRequest($app_id, $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 'getById' + * + * @param int $app_id The ID of the app. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getByIdRequest($app_id, string $contentType = self::contentTypes['getById'][0]) + { + + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling getById' + ); + } + + + $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/channel-connection'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'appId' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + + $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 + ); + } + + /** + * Operation update + * + * Update channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request channel_connection_settings_patch_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error + */ + public function update($app_id, $channel_connection_settings_patch_request, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($app_id, $channel_connection_settings_patch_request, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($app_id, $channel_connection_settings_patch_request, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($app_id, $channel_connection_settings_patch_request, $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: + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' !== '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\Extensions\Calling\Model\ChannelConnectionSettingsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Extensions\Calling\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\Extensions\Calling\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($app_id, $channel_connection_settings_patch_request, string $contentType = self::contentTypes['update'][0]) + { + return $this->updateAsyncWithHttpInfo($app_id, $channel_connection_settings_patch_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update channel connection settings + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($app_id, $channel_connection_settings_patch_request, string $contentType = self::contentTypes['update'][0]) + { + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; + $request = $this->updateRequest($app_id, $channel_connection_settings_patch_request, $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 'update' + * + * @param int $app_id The ID of the app. (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($app_id, $channel_connection_settings_patch_request, string $contentType = self::contentTypes['update'][0]) + { + + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling update' + ); + } + + // verify the required parameter 'channel_connection_settings_patch_request' is set + if ($channel_connection_settings_patch_request === null || (is_array($channel_connection_settings_patch_request) && count($channel_connection_settings_patch_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $channel_connection_settings_patch_request when calling update' + ); + } + + + $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/channel-connection'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'appId' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($channel_connection_settings_patch_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_patch_request)); + } else { + $httpBody = $channel_connection_settings_patch_request; + } + } elseif (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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; + } + + $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( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php b/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php index 017ba5731..0c16ec06c 100644 --- a/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php +++ b/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -92,13 +92,13 @@ class RecordingSettingsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -134,7 +134,7 @@ public function getConfig() /** * Operation getUrlFormat * - * Read calling app recording settings + * Retrieve recording settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation @@ -152,7 +152,7 @@ public function getUrlFormat($app_id, string $contentType = self::contentTypes[' /** * Operation getUrlFormatWithHttpInfo * - * Read calling app recording settings + * Retrieve recording settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation @@ -187,18 +187,6 @@ public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::co $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -257,6 +245,19 @@ public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::co ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -311,7 +312,7 @@ public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::co /** * Operation getUrlFormatAsync * - * Read calling app recording settings + * Retrieve recording settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation @@ -332,7 +333,7 @@ function ($response) { /** * Operation getUrlFormatAsyncWithHttpInfo * - * Read calling app recording settings + * Retrieve recording settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation @@ -533,18 +534,6 @@ public function markAsReadyWithHttpInfo($mark_recording_as_ready_request, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -721,7 +710,7 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con /** * Operation registerUrlFormat * - * Register calling app for recording + * Enable the app for call recording * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request recording_settings_request (required) @@ -740,7 +729,7 @@ public function registerUrlFormat($app_id, $recording_settings_request, string $ /** * Operation registerUrlFormatWithHttpInfo * - * Register calling app for recording + * Enable the app for call recording * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) @@ -776,18 +765,6 @@ public function registerUrlFormatWithHttpInfo($app_id, $recording_settings_reque $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -846,6 +823,19 @@ public function registerUrlFormatWithHttpInfo($app_id, $recording_settings_reque ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -900,7 +890,7 @@ public function registerUrlFormatWithHttpInfo($app_id, $recording_settings_reque /** * Operation registerUrlFormatAsync * - * Register calling app for recording + * Enable the app for call recording * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) @@ -922,7 +912,7 @@ function ($response) { /** * Operation registerUrlFormatAsyncWithHttpInfo * - * Register calling app for recording + * Enable the app for call recording * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) @@ -1087,7 +1077,7 @@ public function registerUrlFormatRequest($app_id, $recording_settings_request, s /** * Operation updateUrlFormat * - * Update calling app's recording settings + * Update recording settings * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request recording_settings_patch_request (required) @@ -1106,7 +1096,7 @@ public function updateUrlFormat($app_id, $recording_settings_patch_request, stri /** * Operation updateUrlFormatWithHttpInfo * - * Update calling app's recording settings + * Update recording settings * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request (required) @@ -1142,18 +1132,6 @@ public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_r $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1212,6 +1190,19 @@ public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_r ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1266,7 +1257,7 @@ public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_r /** * Operation updateUrlFormatAsync * - * Update calling app's recording settings + * Update recording settings * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request (required) @@ -1288,7 +1279,7 @@ function ($response) { /** * Operation updateUrlFormatAsyncWithHttpInfo * - * Update calling app's recording settings + * Update recording settings * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request (required) diff --git a/codegen/Crm/Extensions/Calling/Api/SettingsApi.php b/codegen/Crm/Extensions/Calling/Api/SettingsApi.php index 5daae8ad7..7f8211e4d 100644 --- a/codegen/Crm/Extensions/Calling/Api/SettingsApi.php +++ b/codegen/Crm/Extensions/Calling/Api/SettingsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -92,13 +92,13 @@ class SettingsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -186,18 +186,6 @@ public function archiveWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($app_id, $settings_request, string $contentTy $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -501,6 +477,19 @@ public function createWithHttpInfo($app_id, $settings_request, string $contentTy ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -742,7 +731,7 @@ public function createRequest($app_id, $settings_request, string $contentType = /** * Operation getById * - * Get calling settings + * Retrieve settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation @@ -760,7 +749,7 @@ public function getById($app_id, string $contentType = self::contentTypes['getBy /** * Operation getByIdWithHttpInfo * - * Get calling settings + * Retrieve settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation @@ -795,18 +784,6 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -865,6 +842,19 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -919,7 +909,7 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content /** * Operation getByIdAsync * - * Get calling settings + * Retrieve settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation @@ -940,7 +930,7 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Get calling settings + * Retrieve settings * * @param int $app_id The ID of the app. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation @@ -1144,18 +1134,6 @@ public function updateWithHttpInfo($app_id, $settings_patch_request, string $con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1214,6 +1192,19 @@ public function updateWithHttpInfo($app_id, $settings_patch_request, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Extensions/Calling/ApiException.php b/codegen/Crm/Extensions/Calling/ApiException.php index b7c0d8452..191f081e8 100644 --- a/codegen/Crm/Extensions/Calling/ApiException.php +++ b/codegen/Crm/Extensions/Calling/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Extensions/Calling/Configuration.php b/codegen/Crm/Extensions/Calling/Configuration.php index e172b3e5b..e1244b85f 100644 --- a/codegen/Crm/Extensions/Calling/Configuration.php +++ b/codegen/Crm/Extensions/Calling/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Extensions/Calling/HeaderSelector.php b/codegen/Crm/Extensions/Calling/HeaderSelector.php index 15db593b9..9319e9fb7 100644 --- a/codegen/Crm/Extensions/Calling/HeaderSelector.php +++ b/codegen/Crm/Extensions/Calling/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsPatchRequest.php b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsPatchRequest.php new file mode 100644 index 000000000..c5e0e27b2 --- /dev/null +++ b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsPatchRequest.php @@ -0,0 +1,443 @@ + + */ +class ChannelConnectionSettingsPatchRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChannelConnectionSettingsPatchRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is_ready' => 'bool', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is_ready' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_ready' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'is_ready' => 'isReady', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is_ready' => 'setIsReady', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is_ready' => 'getIsReady', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('is_ready', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets is_ready + * + * @return bool|null + */ + public function getIsReady() + { + return $this->container['is_ready']; + } + + /** + * Sets is_ready + * + * @param bool|null $is_ready If true, this app will be considered to support channel connection + * + * @return self + */ + public function setIsReady($is_ready) + { + if (is_null($is_ready)) { + throw new \InvalidArgumentException('non-nullable is_ready cannot be null'); + } + $this->container['is_ready'] = $is_ready; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The URL to fetch phone numbers available for channel connection + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsRequest.php b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsRequest.php new file mode 100644 index 000000000..c3302f1bc --- /dev/null +++ b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsRequest.php @@ -0,0 +1,449 @@ + + */ +class ChannelConnectionSettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChannelConnectionSettingsRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is_ready' => 'bool', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is_ready' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is_ready' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'is_ready' => 'isReady', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is_ready' => 'setIsReady', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is_ready' => 'getIsReady', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('is_ready', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['is_ready'] === null) { + $invalidProperties[] = "'is_ready' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets is_ready + * + * @return bool + */ + public function getIsReady() + { + return $this->container['is_ready']; + } + + /** + * Sets is_ready + * + * @param bool $is_ready If true, this app will be considered to support channel connection + * + * @return self + */ + public function setIsReady($is_ready) + { + if (is_null($is_ready)) { + throw new \InvalidArgumentException('non-nullable is_ready cannot be null'); + } + $this->container['is_ready'] = $is_ready; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url The URL to fetch phone numbers available for channel connection + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsResponse.php b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsResponse.php new file mode 100644 index 000000000..216f4a694 --- /dev/null +++ b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsResponse.php @@ -0,0 +1,523 @@ + + */ +class ChannelConnectionSettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChannelConnectionSettingsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'is_ready' => 'bool', + 'url' => 'string', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'is_ready' => null, + 'url' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'is_ready' => false, + 'url' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'createdAt', + 'is_ready' => 'isReady', + 'url' => 'url', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'is_ready' => 'setIsReady', + 'url' => 'setUrl', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'is_ready' => 'getIsReady', + 'url' => 'getUrl', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('is_ready', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['is_ready'] === null) { + $invalidProperties[] = "'is_ready' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at The timestamp this setting was created + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets is_ready + * + * @return bool + */ + public function getIsReady() + { + return $this->container['is_ready']; + } + + /** + * Sets is_ready + * + * @param bool $is_ready If true, this app will be considered to support channel connection + * + * @return self + */ + public function setIsReady($is_ready) + { + if (is_null($is_ready)) { + throw new \InvalidArgumentException('non-nullable is_ready cannot be null'); + } + $this->container['is_ready'] = $is_ready; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url The URL to fetch phone numbers available for channel connection + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at The timestamp this setting was last updated + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Extensions/Calling/Model/Error.php b/codegen/Crm/Extensions/Calling/Model/Error.php index a121d574b..beeffec0c 100644 --- a/codegen/Crm/Extensions/Calling/Model/Error.php +++ b/codegen/Crm/Extensions/Calling/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php b/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php index e89922f4b..5b75812fc 100644 --- a/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php +++ b/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php b/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php index 75da7755c..276410bc8 100644 --- a/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('engagement_id', $data ?? [], null); } diff --git a/codegen/Crm/Extensions/Calling/Model/ModelInterface.php b/codegen/Crm/Extensions/Calling/Model/ModelInterface.php index 10582de52..91f95b42a 100644 --- a/codegen/Crm/Extensions/Calling/Model/ModelInterface.php +++ b/codegen/Crm/Extensions/Calling/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php index 031e06003..b5b50c8cc 100644 --- a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('url_to_retrieve_authed_recording', $data ?? [], null); } diff --git a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php index f304dee4f..4fc04af16 100644 --- a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('url_to_retrieve_authed_recording', $data ?? [], null); } diff --git a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php index e7718a4de..a59fb4e3b 100644 --- a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php +++ b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('url_to_retrieve_authed_recording', $data ?? [], null); } @@ -305,7 +305,7 @@ public function getUrlToRetrieveAuthedRecording() /** * Sets url_to_retrieve_authed_recording * - * @param string $url_to_retrieve_authed_recording url_to_retrieve_authed_recording + * @param string $url_to_retrieve_authed_recording * * @return self */ diff --git a/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php b/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php index bdc2eaed7..be259f679 100644 --- a/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,9 +58,11 @@ class SettingsPatchRequest implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static $openAPITypes = [ 'supports_custom_objects' => 'bool', + 'uses_remote' => 'bool', 'is_ready' => 'bool', 'name' => 'string', 'width' => 'int', + 'uses_calling_window' => 'bool', 'supports_inbound_calling' => 'bool', 'url' => 'string', 'height' => 'int' @@ -75,9 +77,11 @@ class SettingsPatchRequest implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static $openAPIFormats = [ 'supports_custom_objects' => null, + 'uses_remote' => null, 'is_ready' => null, 'name' => null, 'width' => 'int32', + 'uses_calling_window' => null, 'supports_inbound_calling' => null, 'url' => null, 'height' => 'int32' @@ -90,9 +94,11 @@ class SettingsPatchRequest implements ModelInterface, ArrayAccess, \JsonSerializ */ protected static array $openAPINullables = [ 'supports_custom_objects' => false, + 'uses_remote' => false, 'is_ready' => false, 'name' => false, 'width' => false, + 'uses_calling_window' => false, 'supports_inbound_calling' => false, 'url' => false, 'height' => false @@ -185,9 +191,11 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'supports_custom_objects' => 'supportsCustomObjects', + 'uses_remote' => 'usesRemote', 'is_ready' => 'isReady', 'name' => 'name', 'width' => 'width', + 'uses_calling_window' => 'usesCallingWindow', 'supports_inbound_calling' => 'supportsInboundCalling', 'url' => 'url', 'height' => 'height' @@ -200,9 +208,11 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'supports_custom_objects' => 'setSupportsCustomObjects', + 'uses_remote' => 'setUsesRemote', 'is_ready' => 'setIsReady', 'name' => 'setName', 'width' => 'setWidth', + 'uses_calling_window' => 'setUsesCallingWindow', 'supports_inbound_calling' => 'setSupportsInboundCalling', 'url' => 'setUrl', 'height' => 'setHeight' @@ -215,9 +225,11 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'supports_custom_objects' => 'getSupportsCustomObjects', + 'uses_remote' => 'getUsesRemote', 'is_ready' => 'getIsReady', 'name' => 'getName', 'width' => 'getWidth', + 'uses_calling_window' => 'getUsesCallingWindow', 'supports_inbound_calling' => 'getSupportsInboundCalling', 'url' => 'getUrl', 'height' => 'getHeight' @@ -275,15 +287,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('supports_custom_objects', $data ?? [], null); + $this->setIfExists('uses_remote', $data ?? [], null); $this->setIfExists('is_ready', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('uses_calling_window', $data ?? [], null); $this->setIfExists('supports_inbound_calling', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); $this->setIfExists('height', $data ?? [], null); @@ -358,6 +372,33 @@ public function setSupportsCustomObjects($supports_custom_objects) return $this; } + /** + * Gets uses_remote + * + * @return bool|null + */ + public function getUsesRemote() + { + return $this->container['uses_remote']; + } + + /** + * Sets uses_remote + * + * @param bool|null $uses_remote When false, this indicates that your calling app does not use the anchored calling remote within the HubSpot app. + * + * @return self + */ + public function setUsesRemote($uses_remote) + { + if (is_null($uses_remote)) { + throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + } + $this->container['uses_remote'] = $uses_remote; + + return $this; + } + /** * Gets is_ready * @@ -439,6 +480,33 @@ public function setWidth($width) return $this; } + /** + * Gets uses_calling_window + * + * @return bool|null + */ + public function getUsesCallingWindow() + { + return $this->container['uses_calling_window']; + } + + /** + * Sets uses_calling_window + * + * @param bool|null $uses_calling_window When false, this indicates that your calling app does not require the use of the separate calling window to hold the call connection. + * + * @return self + */ + public function setUsesCallingWindow($uses_calling_window) + { + if (is_null($uses_calling_window)) { + throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); + } + $this->container['uses_calling_window'] = $uses_calling_window; + + return $this; + } + /** * Gets supports_inbound_calling * diff --git a/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php b/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php index 5290a8166..e3697f470 100644 --- a/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,9 +58,11 @@ class SettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'supports_custom_objects' => 'bool', + 'uses_remote' => 'bool', 'is_ready' => 'bool', 'name' => 'string', 'width' => 'int', + 'uses_calling_window' => 'bool', 'supports_inbound_calling' => 'bool', 'url' => 'string', 'height' => 'int' @@ -75,9 +77,11 @@ class SettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'supports_custom_objects' => null, + 'uses_remote' => null, 'is_ready' => null, 'name' => null, 'width' => 'int32', + 'uses_calling_window' => null, 'supports_inbound_calling' => null, 'url' => null, 'height' => 'int32' @@ -90,9 +94,11 @@ class SettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'supports_custom_objects' => false, + 'uses_remote' => false, 'is_ready' => false, 'name' => false, 'width' => false, + 'uses_calling_window' => false, 'supports_inbound_calling' => false, 'url' => false, 'height' => false @@ -185,9 +191,11 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'supports_custom_objects' => 'supportsCustomObjects', + 'uses_remote' => 'usesRemote', 'is_ready' => 'isReady', 'name' => 'name', 'width' => 'width', + 'uses_calling_window' => 'usesCallingWindow', 'supports_inbound_calling' => 'supportsInboundCalling', 'url' => 'url', 'height' => 'height' @@ -200,9 +208,11 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'supports_custom_objects' => 'setSupportsCustomObjects', + 'uses_remote' => 'setUsesRemote', 'is_ready' => 'setIsReady', 'name' => 'setName', 'width' => 'setWidth', + 'uses_calling_window' => 'setUsesCallingWindow', 'supports_inbound_calling' => 'setSupportsInboundCalling', 'url' => 'setUrl', 'height' => 'setHeight' @@ -215,9 +225,11 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'supports_custom_objects' => 'getSupportsCustomObjects', + 'uses_remote' => 'getUsesRemote', 'is_ready' => 'getIsReady', 'name' => 'getName', 'width' => 'getWidth', + 'uses_calling_window' => 'getUsesCallingWindow', 'supports_inbound_calling' => 'getSupportsInboundCalling', 'url' => 'getUrl', 'height' => 'getHeight' @@ -275,15 +287,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('supports_custom_objects', $data ?? [], null); + $this->setIfExists('uses_remote', $data ?? [], null); $this->setIfExists('is_ready', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('uses_calling_window', $data ?? [], null); $this->setIfExists('supports_inbound_calling', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); $this->setIfExists('height', $data ?? [], null); @@ -364,6 +378,33 @@ public function setSupportsCustomObjects($supports_custom_objects) return $this; } + /** + * Gets uses_remote + * + * @return bool|null + */ + public function getUsesRemote() + { + return $this->container['uses_remote']; + } + + /** + * Sets uses_remote + * + * @param bool|null $uses_remote When false, this indicates that your calling app does not use the anchored calling remote within the HubSpot app. + * + * @return self + */ + public function setUsesRemote($uses_remote) + { + if (is_null($uses_remote)) { + throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + } + $this->container['uses_remote'] = $uses_remote; + + return $this; + } + /** * Gets is_ready * @@ -445,6 +486,33 @@ public function setWidth($width) return $this; } + /** + * Gets uses_calling_window + * + * @return bool|null + */ + public function getUsesCallingWindow() + { + return $this->container['uses_calling_window']; + } + + /** + * Sets uses_calling_window + * + * @param bool|null $uses_calling_window When false, this indicates that your calling app does not require the use of the separate calling window to hold the call connection. + * + * @return self + */ + public function setUsesCallingWindow($uses_calling_window) + { + if (is_null($uses_calling_window)) { + throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); + } + $this->container['uses_calling_window'] = $uses_calling_window; + + return $this; + } + /** * Gets supports_inbound_calling * diff --git a/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php b/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php index 40092a042..7d2dc42e8 100644 --- a/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php +++ b/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -59,9 +59,11 @@ class SettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'created_at' => '\DateTime', 'supports_custom_objects' => 'bool', + 'uses_remote' => 'bool', 'is_ready' => 'bool', 'name' => 'string', 'width' => 'int', + 'uses_calling_window' => 'bool', 'supports_inbound_calling' => 'bool', 'url' => 'string', 'height' => 'int', @@ -78,9 +80,11 @@ class SettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'created_at' => 'date-time', 'supports_custom_objects' => null, + 'uses_remote' => null, 'is_ready' => null, 'name' => null, 'width' => 'int32', + 'uses_calling_window' => null, 'supports_inbound_calling' => null, 'url' => null, 'height' => 'int32', @@ -95,9 +99,11 @@ class SettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'created_at' => false, 'supports_custom_objects' => false, + 'uses_remote' => false, 'is_ready' => false, 'name' => false, 'width' => false, + 'uses_calling_window' => false, 'supports_inbound_calling' => false, 'url' => false, 'height' => false, @@ -192,9 +198,11 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'created_at' => 'createdAt', 'supports_custom_objects' => 'supportsCustomObjects', + 'uses_remote' => 'usesRemote', 'is_ready' => 'isReady', 'name' => 'name', 'width' => 'width', + 'uses_calling_window' => 'usesCallingWindow', 'supports_inbound_calling' => 'supportsInboundCalling', 'url' => 'url', 'height' => 'height', @@ -209,9 +217,11 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'created_at' => 'setCreatedAt', 'supports_custom_objects' => 'setSupportsCustomObjects', + 'uses_remote' => 'setUsesRemote', 'is_ready' => 'setIsReady', 'name' => 'setName', 'width' => 'setWidth', + 'uses_calling_window' => 'setUsesCallingWindow', 'supports_inbound_calling' => 'setSupportsInboundCalling', 'url' => 'setUrl', 'height' => 'setHeight', @@ -226,9 +236,11 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'created_at' => 'getCreatedAt', 'supports_custom_objects' => 'getSupportsCustomObjects', + 'uses_remote' => 'getUsesRemote', 'is_ready' => 'getIsReady', 'name' => 'getName', 'width' => 'getWidth', + 'uses_calling_window' => 'getUsesCallingWindow', 'supports_inbound_calling' => 'getSupportsInboundCalling', 'url' => 'getUrl', 'height' => 'getHeight', @@ -287,16 +299,18 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('supports_custom_objects', $data ?? [], null); + $this->setIfExists('uses_remote', $data ?? [], null); $this->setIfExists('is_ready', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('uses_calling_window', $data ?? [], null); $this->setIfExists('supports_inbound_calling', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); $this->setIfExists('height', $data ?? [], null); @@ -336,6 +350,9 @@ public function listInvalidProperties() if ($this->container['supports_custom_objects'] === null) { $invalidProperties[] = "'supports_custom_objects' can't be null"; } + if ($this->container['uses_remote'] === null) { + $invalidProperties[] = "'uses_remote' can't be null"; + } if ($this->container['is_ready'] === null) { $invalidProperties[] = "'is_ready' can't be null"; } @@ -345,6 +362,9 @@ public function listInvalidProperties() if ($this->container['width'] === null) { $invalidProperties[] = "'width' can't be null"; } + if ($this->container['uses_calling_window'] === null) { + $invalidProperties[] = "'uses_calling_window' can't be null"; + } if ($this->container['supports_inbound_calling'] === null) { $invalidProperties[] = "'supports_inbound_calling' can't be null"; } @@ -426,6 +446,33 @@ public function setSupportsCustomObjects($supports_custom_objects) return $this; } + /** + * Gets uses_remote + * + * @return bool + */ + public function getUsesRemote() + { + return $this->container['uses_remote']; + } + + /** + * Sets uses_remote + * + * @param bool $uses_remote When false, this indicates that your calling app does not use the anchored calling remote within the HubSpot app. + * + * @return self + */ + public function setUsesRemote($uses_remote) + { + if (is_null($uses_remote)) { + throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + } + $this->container['uses_remote'] = $uses_remote; + + return $this; + } + /** * Gets is_ready * @@ -507,6 +554,33 @@ public function setWidth($width) return $this; } + /** + * Gets uses_calling_window + * + * @return bool + */ + public function getUsesCallingWindow() + { + return $this->container['uses_calling_window']; + } + + /** + * Sets uses_calling_window + * + * @param bool $uses_calling_window When false, this indicates that your calling app does not require the use of the separate calling window to hold the call connection. + * + * @return self + */ + public function setUsesCallingWindow($uses_calling_window) + { + if (is_null($uses_calling_window)) { + throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); + } + $this->container['uses_calling_window'] = $uses_calling_window; + + return $this; + } + /** * Gets supports_inbound_calling * diff --git a/codegen/Crm/Extensions/Calling/ObjectSerializer.php b/codegen/Crm/Extensions/Calling/ObjectSerializer.php index 3297ff2ab..ebd275866 100644 --- a/codegen/Crm/Extensions/Calling/ObjectSerializer.php +++ b/codegen/Crm/Extensions/Calling/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Extensions/Cards/Api/CardsApi.php b/codegen/Crm/Extensions/Cards/Api/CardsApi.php index a437850b4..fcbfe4b21 100644 --- a/codegen/Crm/Extensions/Cards/Api/CardsApi.php +++ b/codegen/Crm/Extensions/Cards/Api/CardsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class CardsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -191,18 +191,6 @@ public function archiveWithHttpInfo($card_id, $app_id, string $contentType = sel $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -454,18 +442,6 @@ public function createWithHttpInfo($app_id, $card_create_request, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -524,6 +500,19 @@ public function createWithHttpInfo($app_id, $card_create_request, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -818,18 +807,6 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -888,6 +865,19 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardListResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1167,18 +1157,6 @@ public function getByIdWithHttpInfo($card_id, $app_id, string $contentType = sel $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1237,6 +1215,19 @@ public function getByIdWithHttpInfo($card_id, $app_id, string $contentType = sel ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1536,18 +1527,6 @@ public function updateWithHttpInfo($card_id, $app_id, $card_patch_request, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1606,6 +1585,19 @@ public function updateWithHttpInfo($card_id, $app_id, $card_patch_request, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\PublicCardResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php b/codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php index 77cd2651f..a6f9d61ab 100644 --- a/codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php +++ b/codegen/Crm/Extensions/Cards/Api/SampleResponseApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SampleResponseApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -176,18 +176,6 @@ public function getCardsSampleResponseWithHttpInfo(string $contentType = self::c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -246,6 +234,19 @@ public function getCardsSampleResponseWithHttpInfo(string $contentType = self::c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Cards\Model\IntegratorCardPayloadResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Extensions/Cards/ApiException.php b/codegen/Crm/Extensions/Cards/ApiException.php index 0bfe0ed27..abd45abf1 100644 --- a/codegen/Crm/Extensions/Cards/ApiException.php +++ b/codegen/Crm/Extensions/Cards/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Extensions/Cards/Configuration.php b/codegen/Crm/Extensions/Cards/Configuration.php index 1a122a690..9df5d68f9 100644 --- a/codegen/Crm/Extensions/Cards/Configuration.php +++ b/codegen/Crm/Extensions/Cards/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Extensions/Cards/HeaderSelector.php b/codegen/Crm/Extensions/Cards/HeaderSelector.php index 4202cec7e..f64007c63 100644 --- a/codegen/Crm/Extensions/Cards/HeaderSelector.php +++ b/codegen/Crm/Extensions/Cards/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Extensions/Cards/Model/ActionConfirmationBody.php b/codegen/Crm/Extensions/Cards/Model/ActionConfirmationBody.php index 402814d86..87629d480 100644 --- a/codegen/Crm/Extensions/Cards/Model/ActionConfirmationBody.php +++ b/codegen/Crm/Extensions/Cards/Model/ActionConfirmationBody.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('confirm_button_label', $data ?? [], null); $this->setIfExists('cancel_button_label', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/ActionHookActionBody.php b/codegen/Crm/Extensions/Cards/Model/ActionHookActionBody.php index 60d18f59c..1a70056fe 100644 --- a/codegen/Crm/Extensions/Cards/Model/ActionHookActionBody.php +++ b/codegen/Crm/Extensions/Cards/Model/ActionHookActionBody.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -311,10 +311,10 @@ public function getHttpMethodAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('property_names_included', $data ?? [], null); $this->setIfExists('confirmation', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/CardActions.php b/codegen/Crm/Extensions/Cards/Model/CardActions.php index d6254c2b6..bfca6a377 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardActions.php +++ b/codegen/Crm/Extensions/Cards/Model/CardActions.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('base_urls', $data ?? [], null); } diff --git a/codegen/Crm/Extensions/Cards/Model/CardAuditResponse.php b/codegen/Crm/Extensions/Cards/Model/CardAuditResponse.php index 911b2fab7..78662da53 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardAuditResponse.php +++ b/codegen/Crm/Extensions/Cards/Model/CardAuditResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -303,10 +303,10 @@ public function getAuthSourceAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('action_type', $data ?? [], null); $this->setIfExists('object_type_id', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/CardCreateRequest.php b/codegen/Crm/Extensions/Cards/Model/CardCreateRequest.php index 04ed7a831..8c6fdbe77 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardCreateRequest.php +++ b/codegen/Crm/Extensions/Cards/Model/CardCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('fetch', $data ?? [], null); $this->setIfExists('display', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/CardDisplayBody.php b/codegen/Crm/Extensions/Cards/Model/CardDisplayBody.php index 85535cb80..b4c13f7dc 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardDisplayBody.php +++ b/codegen/Crm/Extensions/Cards/Model/CardDisplayBody.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties', $data ?? [], null); } diff --git a/codegen/Crm/Extensions/Cards/Model/CardDisplayProperty.php b/codegen/Crm/Extensions/Cards/Model/CardDisplayProperty.php index b8de71f06..aa516eb22 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardDisplayProperty.php +++ b/codegen/Crm/Extensions/Cards/Model/CardDisplayProperty.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getDataTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('data_type', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/CardFetchBody.php b/codegen/Crm/Extensions/Cards/Model/CardFetchBody.php index eec862a13..920c19ef9 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardFetchBody.php +++ b/codegen/Crm/Extensions/Cards/Model/CardFetchBody.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -273,10 +273,10 @@ public function getCardTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('serverless_function', $data ?? [], null); $this->setIfExists('card_type', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/CardFetchBodyPatch.php b/codegen/Crm/Extensions/Cards/Model/CardFetchBodyPatch.php index 89fc67a26..67b86aee6 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardFetchBodyPatch.php +++ b/codegen/Crm/Extensions/Cards/Model/CardFetchBodyPatch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -273,10 +273,10 @@ public function getCardTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('serverless_function', $data ?? [], null); $this->setIfExists('card_type', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/CardObjectTypeBody.php b/codegen/Crm/Extensions/Cards/Model/CardObjectTypeBody.php index f283068b0..b059c8ba3 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardObjectTypeBody.php +++ b/codegen/Crm/Extensions/Cards/Model/CardObjectTypeBody.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -266,10 +266,10 @@ public function getNameAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('properties_to_send', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/CardPatchRequest.php b/codegen/Crm/Extensions/Cards/Model/CardPatchRequest.php index 584b54ef7..ccc847a4c 100644 --- a/codegen/Crm/Extensions/Cards/Model/CardPatchRequest.php +++ b/codegen/Crm/Extensions/Cards/Model/CardPatchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('fetch', $data ?? [], null); $this->setIfExists('display', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/DisplayOption.php b/codegen/Crm/Extensions/Cards/Model/DisplayOption.php index 16f476648..d0903bb7b 100644 --- a/codegen/Crm/Extensions/Cards/Model/DisplayOption.php +++ b/codegen/Crm/Extensions/Cards/Model/DisplayOption.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -273,10 +273,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/Error.php b/codegen/Crm/Extensions/Cards/Model/Error.php index 87653104c..74af8d8b2 100644 --- a/codegen/Crm/Extensions/Cards/Model/Error.php +++ b/codegen/Crm/Extensions/Cards/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/ErrorDetail.php b/codegen/Crm/Extensions/Cards/Model/ErrorDetail.php index feead66d3..38f4c56b6 100644 --- a/codegen/Crm/Extensions/Cards/Model/ErrorDetail.php +++ b/codegen/Crm/Extensions/Cards/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/IFrameActionBody.php b/codegen/Crm/Extensions/Cards/Model/IFrameActionBody.php index 38d8e8b6b..943ca7cf0 100644 --- a/codegen/Crm/Extensions/Cards/Model/IFrameActionBody.php +++ b/codegen/Crm/Extensions/Cards/Model/IFrameActionBody.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('property_names_included', $data ?? [], null); $this->setIfExists('width', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/IntegratorCardPayloadResponse.php b/codegen/Crm/Extensions/Cards/Model/IntegratorCardPayloadResponse.php index 6dd58c8cb..c97c99828 100644 --- a/codegen/Crm/Extensions/Cards/Model/IntegratorCardPayloadResponse.php +++ b/codegen/Crm/Extensions/Cards/Model/IntegratorCardPayloadResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -285,10 +285,10 @@ public function getResponseVersionAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('response_version', $data ?? [], null); $this->setIfExists('card_label', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResult.php b/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResult.php index 829ed5a5a..401fc7dea 100644 --- a/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResult.php +++ b/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResult.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link_url', $data ?? [], null); $this->setIfExists('tokens', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResultActionsInner.php b/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResultActionsInner.php index 8b4eb8291..34f367e98 100644 --- a/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResultActionsInner.php +++ b/codegen/Crm/Extensions/Cards/Model/IntegratorObjectResultActionsInner.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -325,10 +325,10 @@ public function getHttpMethodAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('property_names_included', $data ?? [], null); $this->setIfExists('confirmation', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/ModelInterface.php b/codegen/Crm/Extensions/Cards/Model/ModelInterface.php index 6cd6a0c76..c3ac81a15 100644 --- a/codegen/Crm/Extensions/Cards/Model/ModelInterface.php +++ b/codegen/Crm/Extensions/Cards/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Extensions/Cards/Model/ObjectToken.php b/codegen/Crm/Extensions/Cards/Model/ObjectToken.php index 6ff802fec..aa3de3a3a 100644 --- a/codegen/Crm/Extensions/Cards/Model/ObjectToken.php +++ b/codegen/Crm/Extensions/Cards/Model/ObjectToken.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -286,10 +286,10 @@ public function getDataTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('data_type', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/PublicCardFetchBody.php b/codegen/Crm/Extensions/Cards/Model/PublicCardFetchBody.php index c08a224da..f892b3504 100644 --- a/codegen/Crm/Extensions/Cards/Model/PublicCardFetchBody.php +++ b/codegen/Crm/Extensions/Cards/Model/PublicCardFetchBody.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_types', $data ?? [], null); $this->setIfExists('target_url', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/PublicCardListResponse.php b/codegen/Crm/Extensions/Cards/Model/PublicCardListResponse.php index df2e41052..30257926f 100644 --- a/codegen/Crm/Extensions/Cards/Model/PublicCardListResponse.php +++ b/codegen/Crm/Extensions/Cards/Model/PublicCardListResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Extensions/Cards/Model/PublicCardResponse.php b/codegen/Crm/Extensions/Cards/Model/PublicCardResponse.php index 564d2a68b..b9cb96562 100644 --- a/codegen/Crm/Extensions/Cards/Model/PublicCardResponse.php +++ b/codegen/Crm/Extensions/Cards/Model/PublicCardResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('fetch', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/Model/TopLevelActions.php b/codegen/Crm/Extensions/Cards/Model/TopLevelActions.php index 36e65c2ff..db9da1269 100644 --- a/codegen/Crm/Extensions/Cards/Model/TopLevelActions.php +++ b/codegen/Crm/Extensions/Cards/Model/TopLevelActions.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('secondary', $data ?? [], null); $this->setIfExists('settings', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Cards/ObjectSerializer.php b/codegen/Crm/Extensions/Cards/ObjectSerializer.php index 9e698636b..612446c11 100644 --- a/codegen/Crm/Extensions/Cards/ObjectSerializer.php +++ b/codegen/Crm/Extensions/Cards/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php b/codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php index bd60232c1..acd477c7b 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php +++ b/codegen/Crm/Extensions/Videoconferencing/Api/SettingsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -89,13 +89,13 @@ class SettingsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -183,18 +183,6 @@ public function archiveWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -426,18 +414,6 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -496,6 +472,19 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -775,18 +764,6 @@ public function replaceWithHttpInfo($app_id, $external_settings, string $content $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -845,6 +822,19 @@ public function replaceWithHttpInfo($app_id, $external_settings, string $content ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Extensions\Videoconferencing\Model\ExternalSettings'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Extensions/Videoconferencing/ApiException.php b/codegen/Crm/Extensions/Videoconferencing/ApiException.php index b62b36bd7..4dc3622fb 100644 --- a/codegen/Crm/Extensions/Videoconferencing/ApiException.php +++ b/codegen/Crm/Extensions/Videoconferencing/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Extensions/Videoconferencing/Configuration.php b/codegen/Crm/Extensions/Videoconferencing/Configuration.php index 80759829c..ce9cad7d8 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Configuration.php +++ b/codegen/Crm/Extensions/Videoconferencing/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Extensions/Videoconferencing/HeaderSelector.php b/codegen/Crm/Extensions/Videoconferencing/HeaderSelector.php index 8fa9a9276..04cb47ebb 100644 --- a/codegen/Crm/Extensions/Videoconferencing/HeaderSelector.php +++ b/codegen/Crm/Extensions/Videoconferencing/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Extensions/Videoconferencing/Model/Error.php b/codegen/Crm/Extensions/Videoconferencing/Model/Error.php index b64363c20..f6d121f0c 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Model/Error.php +++ b/codegen/Crm/Extensions/Videoconferencing/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Videoconferencing/Model/ErrorDetail.php b/codegen/Crm/Extensions/Videoconferencing/Model/ErrorDetail.php index bfa33d103..bdcbee7db 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Model/ErrorDetail.php +++ b/codegen/Crm/Extensions/Videoconferencing/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Videoconferencing/Model/ExternalSettings.php b/codegen/Crm/Extensions/Videoconferencing/Model/ExternalSettings.php index 375bf6145..6384269ed 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Model/ExternalSettings.php +++ b/codegen/Crm/Extensions/Videoconferencing/Model/ExternalSettings.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('user_verify_url', $data ?? [], null); $this->setIfExists('fetch_accounts_uri', $data ?? [], null); diff --git a/codegen/Crm/Extensions/Videoconferencing/Model/ModelInterface.php b/codegen/Crm/Extensions/Videoconferencing/Model/ModelInterface.php index c591eb2d3..7410ca03b 100644 --- a/codegen/Crm/Extensions/Videoconferencing/Model/ModelInterface.php +++ b/codegen/Crm/Extensions/Videoconferencing/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Extensions/Videoconferencing/ObjectSerializer.php b/codegen/Crm/Extensions/Videoconferencing/ObjectSerializer.php index 783172781..080d608bc 100644 --- a/codegen/Crm/Extensions/Videoconferencing/ObjectSerializer.php +++ b/codegen/Crm/Extensions/Videoconferencing/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Imports/Api/CoreApi.php b/codegen/Crm/Imports/Api/CoreApi.php index 867e177bb..0f962f0c5 100644 --- a/codegen/Crm/Imports/Api/CoreApi.php +++ b/codegen/Crm/Imports/Api/CoreApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -92,13 +92,13 @@ class CoreApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -187,18 +187,6 @@ public function cancelWithHttpInfo($import_id, string $contentType = self::conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -257,6 +245,19 @@ public function cancelWithHttpInfo($import_id, string $contentType = self::conte ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Imports\Model\ActionResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -482,8 +483,8 @@ public function cancelRequest($import_id, string $contentType = self::contentTyp * * Start a new import * - * @param \SplFileObject $files A list of files containing the data to import (optional) - * @param string $import_request JSON formatted metadata about the import. This includes a name for the import and the column mappings for each file. See the overview tab for more on the required format. (optional) + * @param \SplFileObject|null $files files (optional) + * @param string|null $import_request import_request (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format @@ -501,8 +502,8 @@ public function create($files = null, $import_request = null, string $contentTyp * * Start a new import * - * @param \SplFileObject $files A list of files containing the data to import (optional) - * @param string $import_request JSON formatted metadata about the import. This includes a name for the import and the column mappings for each file. See the overview tab for more on the required format. (optional) + * @param \SplFileObject|null $files (optional) + * @param string|null $import_request (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format @@ -535,18 +536,6 @@ public function createWithHttpInfo($files = null, $import_request = null, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -605,6 +594,19 @@ public function createWithHttpInfo($files = null, $import_request = null, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -661,8 +663,8 @@ public function createWithHttpInfo($files = null, $import_request = null, string * * Start a new import * - * @param \SplFileObject $files A list of files containing the data to import (optional) - * @param string $import_request JSON formatted metadata about the import. This includes a name for the import and the column mappings for each file. See the overview tab for more on the required format. (optional) + * @param \SplFileObject|null $files (optional) + * @param string|null $import_request (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -683,8 +685,8 @@ function ($response) { * * Start a new import * - * @param \SplFileObject $files A list of files containing the data to import (optional) - * @param string $import_request JSON formatted metadata about the import. This includes a name for the import and the column mappings for each file. See the overview tab for more on the required format. (optional) + * @param \SplFileObject|null $files (optional) + * @param string|null $import_request (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -734,8 +736,8 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \SplFileObject $files A list of files containing the data to import (optional) - * @param string $import_request JSON formatted metadata about the import. This includes a name for the import and the column mappings for each file. See the overview tab for more on the required format. (optional) + * @param \SplFileObject|null $files (optional) + * @param string|null $import_request (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -774,6 +776,7 @@ public function createRequest($files = null, $import_request = null, string $con $formParams['importRequest'] = ObjectSerializer::toFormValue($import_request); } + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*', ], $contentType, @@ -887,18 +890,6 @@ public function getByIdWithHttpInfo($import_id, string $contentType = self::cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -957,6 +948,19 @@ public function getByIdWithHttpInfo($import_id, string $contentType = self::cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Imports\Model\PublicImportResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1182,9 +1186,9 @@ public function getByIdRequest($import_id, string $contentType = self::contentTy * * Get active imports * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before before (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format @@ -1202,9 +1206,9 @@ public function getPage($after = null, $before = null, $limit = null, string $co * * Get active imports * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format @@ -1237,18 +1241,6 @@ public function getPageWithHttpInfo($after = null, $before = null, $limit = null $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1307,6 +1299,19 @@ public function getPageWithHttpInfo($after = null, $before = null, $limit = null ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1363,9 +1368,9 @@ public function getPageWithHttpInfo($after = null, $before = null, $limit = null * * Get active imports * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1386,9 +1391,9 @@ function ($response) { * * Get active imports * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1438,9 +1443,9 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Imports/Api/PublicImportsApi.php b/codegen/Crm/Imports/Api/PublicImportsApi.php index 90fa61864..5db08c44c 100644 --- a/codegen/Crm/Imports/Api/PublicImportsApi.php +++ b/codegen/Crm/Imports/Api/PublicImportsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class PublicImportsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -126,17 +126,19 @@ public function getConfig() * Operation getErrors * * @param int $import_id import_id (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional) + * @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging|\HubSpot\Client\Crm\Imports\Model\Error */ - public function getErrors($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0]) + public function getErrors($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) { - list($response) = $this->getErrorsWithHttpInfo($import_id, $after, $limit, $contentType); + list($response) = $this->getErrorsWithHttpInfo($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType); return $response; } @@ -144,17 +146,19 @@ public function getErrors($import_id, $after = null, $limit = null, string $cont * Operation getErrorsWithHttpInfo * * @param int $import_id (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional) + * @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Imports\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging|\HubSpot\Client\Crm\Imports\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0]) + public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) { - $request = $this->getErrorsRequest($import_id, $after, $limit, $contentType); + $request = $this->getErrorsRequest($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType); try { $options = $this->createHttpClientOption(); @@ -178,18 +182,6 @@ public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -248,6 +240,19 @@ public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -303,16 +308,18 @@ public function getErrorsWithHttpInfo($import_id, $after = null, $limit = null, * Operation getErrorsAsync * * @param int $import_id (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional) + * @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getErrorsAsync($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0]) + public function getErrorsAsync($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) { - return $this->getErrorsAsyncWithHttpInfo($import_id, $after, $limit, $contentType) + return $this->getErrorsAsyncWithHttpInfo($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType) ->then( function ($response) { return $response[0]; @@ -324,17 +331,19 @@ function ($response) { * Operation getErrorsAsyncWithHttpInfo * * @param int $import_id (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional) + * @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getErrorsAsyncWithHttpInfo($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0]) + public function getErrorsAsyncWithHttpInfo($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) { $returnType = '\HubSpot\Client\Crm\Imports\Model\CollectionResponsePublicImportErrorForwardPaging'; - $request = $this->getErrorsRequest($import_id, $after, $limit, $contentType); + $request = $this->getErrorsRequest($import_id, $after, $limit, $include_error_message, $include_row_data, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -376,14 +385,16 @@ function ($exception) { * Create request for operation 'getErrors' * * @param int $import_id (required) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $include_error_message Set to True to receive a message explaining the error. (optional) + * @param bool|null $include_row_data Set to True to receive the data values for the errored row. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getErrors'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getErrorsRequest($import_id, $after = null, $limit = null, string $contentType = self::contentTypes['getErrors'][0]) + public function getErrorsRequest($import_id, $after = null, $limit = null, $include_error_message = null, $include_row_data = null, string $contentType = self::contentTypes['getErrors'][0]) { // verify the required parameter 'import_id' is set @@ -396,6 +407,8 @@ public function getErrorsRequest($import_id, $after = null, $limit = null, strin + + $resourcePath = '/crm/v3/imports/{importId}/errors'; $formParams = []; $queryParams = []; @@ -421,6 +434,24 @@ public function getErrorsRequest($import_id, $after = null, $limit = null, strin true, // explode false // required ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_error_message, + 'includeErrorMessage', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_row_data, + 'includeRowData', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params diff --git a/codegen/Crm/Imports/ApiException.php b/codegen/Crm/Imports/ApiException.php index d40b1c249..ba4acf593 100644 --- a/codegen/Crm/Imports/ApiException.php +++ b/codegen/Crm/Imports/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Imports/Configuration.php b/codegen/Crm/Imports/Configuration.php index c30b5667d..33f32919a 100644 --- a/codegen/Crm/Imports/Configuration.php +++ b/codegen/Crm/Imports/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Imports/HeaderSelector.php b/codegen/Crm/Imports/HeaderSelector.php index d4fe6b708..b2b2fe30f 100644 --- a/codegen/Crm/Imports/HeaderSelector.php +++ b/codegen/Crm/Imports/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Imports/Model/ActionResponse.php b/codegen/Crm/Imports/Model/ActionResponse.php index 520b4ceaf..3eb9c7885 100644 --- a/codegen/Crm/Imports/Model/ActionResponse.php +++ b/codegen/Crm/Imports/Model/ActionResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/CollectionResponsePublicImportErrorForwardPaging.php b/codegen/Crm/Imports/Model/CollectionResponsePublicImportErrorForwardPaging.php index b714b683b..51293c0c8 100644 --- a/codegen/Crm/Imports/Model/CollectionResponsePublicImportErrorForwardPaging.php +++ b/codegen/Crm/Imports/Model/CollectionResponsePublicImportErrorForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php b/codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php index a07fa9ded..1d9c4ac75 100644 --- a/codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php +++ b/codegen/Crm/Imports/Model/CollectionResponsePublicImportResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/Error.php b/codegen/Crm/Imports/Model/Error.php index 94a12d12e..fcab0c830 100644 --- a/codegen/Crm/Imports/Model/Error.php +++ b/codegen/Crm/Imports/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/ErrorDetail.php b/codegen/Crm/Imports/Model/ErrorDetail.php index d381b4d16..3a9828094 100644 --- a/codegen/Crm/Imports/Model/ErrorDetail.php +++ b/codegen/Crm/Imports/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/ForwardPaging.php b/codegen/Crm/Imports/Model/ForwardPaging.php index 464ed4a2e..4d979d649 100644 --- a/codegen/Crm/Imports/Model/ForwardPaging.php +++ b/codegen/Crm/Imports/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Imports/Model/ImportRowCore.php b/codegen/Crm/Imports/Model/ImportRowCore.php index e46b4e3f8..10d586606 100644 --- a/codegen/Crm/Imports/Model/ImportRowCore.php +++ b/codegen/Crm/Imports/Model/ImportRowCore.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,6 +58,7 @@ class ImportRowCore implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'row_data' => 'string[]', + 'contains_encrypted_properties' => 'bool', 'line_number' => 'int', 'page_name' => 'string', 'file_id' => 'int' @@ -72,6 +73,7 @@ class ImportRowCore implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'row_data' => null, + 'contains_encrypted_properties' => null, 'line_number' => 'int32', 'page_name' => null, 'file_id' => 'int32' @@ -84,6 +86,7 @@ class ImportRowCore implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'row_data' => false, + 'contains_encrypted_properties' => false, 'line_number' => false, 'page_name' => false, 'file_id' => false @@ -176,6 +179,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'row_data' => 'rowData', + 'contains_encrypted_properties' => 'containsEncryptedProperties', 'line_number' => 'lineNumber', 'page_name' => 'pageName', 'file_id' => 'fileId' @@ -188,6 +192,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'row_data' => 'setRowData', + 'contains_encrypted_properties' => 'setContainsEncryptedProperties', 'line_number' => 'setLineNumber', 'page_name' => 'setPageName', 'file_id' => 'setFileId' @@ -200,6 +205,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'row_data' => 'getRowData', + 'contains_encrypted_properties' => 'getContainsEncryptedProperties', 'line_number' => 'getLineNumber', 'page_name' => 'getPageName', 'file_id' => 'getFileId' @@ -257,12 +263,13 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('row_data', $data ?? [], null); + $this->setIfExists('contains_encrypted_properties', $data ?? [], null); $this->setIfExists('line_number', $data ?? [], null); $this->setIfExists('page_name', $data ?? [], null); $this->setIfExists('file_id', $data ?? [], null); @@ -298,6 +305,9 @@ public function listInvalidProperties() if ($this->container['row_data'] === null) { $invalidProperties[] = "'row_data' can't be null"; } + if ($this->container['contains_encrypted_properties'] === null) { + $invalidProperties[] = "'contains_encrypted_properties' can't be null"; + } if ($this->container['line_number'] === null) { $invalidProperties[] = "'line_number' can't be null"; } @@ -346,6 +356,33 @@ public function setRowData($row_data) return $this; } + /** + * Gets contains_encrypted_properties + * + * @return bool + */ + public function getContainsEncryptedProperties() + { + return $this->container['contains_encrypted_properties']; + } + + /** + * Sets contains_encrypted_properties + * + * @param bool $contains_encrypted_properties contains_encrypted_properties + * + * @return self + */ + public function setContainsEncryptedProperties($contains_encrypted_properties) + { + if (is_null($contains_encrypted_properties)) { + throw new \InvalidArgumentException('non-nullable contains_encrypted_properties cannot be null'); + } + $this->container['contains_encrypted_properties'] = $contains_encrypted_properties; + + return $this; + } + /** * Gets line_number * diff --git a/codegen/Crm/Imports/Model/ImportTemplate.php b/codegen/Crm/Imports/Model/ImportTemplate.php index 61b846048..de457ade4 100644 --- a/codegen/Crm/Imports/Model/ImportTemplate.php +++ b/codegen/Crm/Imports/Model/ImportTemplate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getTemplateTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('template_type', $data ?? [], null); $this->setIfExists('template_id', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/ModelInterface.php b/codegen/Crm/Imports/Model/ModelInterface.php index a0cfbb959..699d171bc 100644 --- a/codegen/Crm/Imports/Model/ModelInterface.php +++ b/codegen/Crm/Imports/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Imports/Model/NextPage.php b/codegen/Crm/Imports/Model/NextPage.php index fa1c980b7..3330fbb74 100644 --- a/codegen/Crm/Imports/Model/NextPage.php +++ b/codegen/Crm/Imports/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/Paging.php b/codegen/Crm/Imports/Model/Paging.php index 45b9f51ae..69356d320 100644 --- a/codegen/Crm/Imports/Model/Paging.php +++ b/codegen/Crm/Imports/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/PreviousPage.php b/codegen/Crm/Imports/Model/PreviousPage.php index 16385e6a8..54686b879 100644 --- a/codegen/Crm/Imports/Model/PreviousPage.php +++ b/codegen/Crm/Imports/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/PropertyValue.php b/codegen/Crm/Imports/Model/PropertyValue.php new file mode 100644 index 000000000..a09b43074 --- /dev/null +++ b/codegen/Crm/Imports/Model/PropertyValue.php @@ -0,0 +1,1289 @@ + + */ +class PropertyValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PropertyValue'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'source_id' => 'string', + 'selected_by_user' => 'bool', + 'source_label' => 'string', + 'source' => 'string', + 'updated_by_user_id' => 'int', + 'persistence_timestamp' => 'int', + 'source_metadata' => 'string', + 'data_sensitivity' => 'string', + 'source_vid' => 'int[]', + 'unit' => 'string', + 'request_id' => 'string', + 'is_encrypted' => 'bool', + 'name' => 'string', + 'use_timestamp_as_persistence_timestamp' => 'bool', + 'value' => 'string', + 'selected_by_user_timestamp' => 'int', + 'timestamp' => 'int', + 'is_large_value' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'source_id' => null, + 'selected_by_user' => null, + 'source_label' => null, + 'source' => null, + 'updated_by_user_id' => 'int32', + 'persistence_timestamp' => 'int64', + 'source_metadata' => null, + 'data_sensitivity' => null, + 'source_vid' => 'int64', + 'unit' => null, + 'request_id' => null, + 'is_encrypted' => null, + 'name' => null, + 'use_timestamp_as_persistence_timestamp' => null, + 'value' => null, + 'selected_by_user_timestamp' => 'int64', + 'timestamp' => 'int64', + 'is_large_value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'selected_by_user' => false, + 'source_label' => false, + 'source' => false, + 'updated_by_user_id' => false, + 'persistence_timestamp' => false, + 'source_metadata' => false, + 'data_sensitivity' => false, + 'source_vid' => false, + 'unit' => false, + 'request_id' => false, + 'is_encrypted' => false, + 'name' => false, + 'use_timestamp_as_persistence_timestamp' => false, + 'value' => false, + 'selected_by_user_timestamp' => false, + 'timestamp' => false, + 'is_large_value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'source_id' => 'sourceId', + 'selected_by_user' => 'selectedByUser', + 'source_label' => 'sourceLabel', + 'source' => 'source', + 'updated_by_user_id' => 'updatedByUserId', + 'persistence_timestamp' => 'persistenceTimestamp', + 'source_metadata' => 'sourceMetadata', + 'data_sensitivity' => 'dataSensitivity', + 'source_vid' => 'sourceVid', + 'unit' => 'unit', + 'request_id' => 'requestId', + 'is_encrypted' => 'isEncrypted', + 'name' => 'name', + 'use_timestamp_as_persistence_timestamp' => 'useTimestampAsPersistenceTimestamp', + 'value' => 'value', + 'selected_by_user_timestamp' => 'selectedByUserTimestamp', + 'timestamp' => 'timestamp', + 'is_large_value' => 'isLargeValue' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'source_id' => 'setSourceId', + 'selected_by_user' => 'setSelectedByUser', + 'source_label' => 'setSourceLabel', + 'source' => 'setSource', + 'updated_by_user_id' => 'setUpdatedByUserId', + 'persistence_timestamp' => 'setPersistenceTimestamp', + 'source_metadata' => 'setSourceMetadata', + 'data_sensitivity' => 'setDataSensitivity', + 'source_vid' => 'setSourceVid', + 'unit' => 'setUnit', + 'request_id' => 'setRequestId', + 'is_encrypted' => 'setIsEncrypted', + 'name' => 'setName', + 'use_timestamp_as_persistence_timestamp' => 'setUseTimestampAsPersistenceTimestamp', + 'value' => 'setValue', + 'selected_by_user_timestamp' => 'setSelectedByUserTimestamp', + 'timestamp' => 'setTimestamp', + 'is_large_value' => 'setIsLargeValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'source_id' => 'getSourceId', + 'selected_by_user' => 'getSelectedByUser', + 'source_label' => 'getSourceLabel', + 'source' => 'getSource', + 'updated_by_user_id' => 'getUpdatedByUserId', + 'persistence_timestamp' => 'getPersistenceTimestamp', + 'source_metadata' => 'getSourceMetadata', + 'data_sensitivity' => 'getDataSensitivity', + 'source_vid' => 'getSourceVid', + 'unit' => 'getUnit', + 'request_id' => 'getRequestId', + 'is_encrypted' => 'getIsEncrypted', + 'name' => 'getName', + 'use_timestamp_as_persistence_timestamp' => 'getUseTimestampAsPersistenceTimestamp', + 'value' => 'getValue', + 'selected_by_user_timestamp' => 'getSelectedByUserTimestamp', + 'timestamp' => 'getTimestamp', + 'is_large_value' => 'getIsLargeValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const SOURCE_UNKNOWN = 'UNKNOWN'; + public const SOURCE_IMPORT = 'IMPORT'; + public const SOURCE_API = 'API'; + public const SOURCE_FORM = 'FORM'; + public const SOURCE_ANALYTICS = 'ANALYTICS'; + public const SOURCE_MIGRATION = 'MIGRATION'; + public const SOURCE_SALESFORCE = 'SALESFORCE'; + public const SOURCE_INTEGRATION = 'INTEGRATION'; + public const SOURCE_CONTACTS_WEB = 'CONTACTS_WEB'; + public const SOURCE_WAL_INCREMENTAL = 'WAL_INCREMENTAL'; + public const SOURCE_TASK = 'TASK'; + public const SOURCE_EMAIL = 'EMAIL'; + public const SOURCE_WORKFLOWS = 'WORKFLOWS'; + public const SOURCE_CALCULATED = 'CALCULATED'; + public const SOURCE_SOCIAL = 'SOCIAL'; + public const SOURCE_BATCH_UPDATE = 'BATCH_UPDATE'; + public const SOURCE_SIGNALS = 'SIGNALS'; + public const SOURCE_BIDEN = 'BIDEN'; + public const SOURCE__DEFAULT = 'DEFAULT'; + public const SOURCE_COMPANIES = 'COMPANIES'; + public const SOURCE_DEALS = 'DEALS'; + public const SOURCE_ASSISTS = 'ASSISTS'; + public const SOURCE_PRESENTATIONS = 'PRESENTATIONS'; + public const SOURCE_TALLY = 'TALLY'; + public const SOURCE_SIDEKICK = 'SIDEKICK'; + public const SOURCE_CRM_UI = 'CRM_UI'; + public const SOURCE_MERGE_CONTACTS = 'MERGE_CONTACTS'; + public const SOURCE_PORTAL_USER_ASSOCIATOR = 'PORTAL_USER_ASSOCIATOR'; + public const SOURCE_INTEGRATIONS_PLATFORM = 'INTEGRATIONS_PLATFORM'; + public const SOURCE_BCC_TO_CRM = 'BCC_TO_CRM'; + public const SOURCE_FORWARD_TO_CRM = 'FORWARD_TO_CRM'; + public const SOURCE_ENGAGEMENTS = 'ENGAGEMENTS'; + public const SOURCE_SALES = 'SALES'; + public const SOURCE_HEISENBERG = 'HEISENBERG'; + public const SOURCE_LEADIN = 'LEADIN'; + public const SOURCE_GMAIL_INTEGRATION = 'GMAIL_INTEGRATION'; + public const SOURCE_ACADEMY = 'ACADEMY'; + public const SOURCE_SALES_MESSAGES = 'SALES_MESSAGES'; + public const SOURCE_AVATARS_SERVICE = 'AVATARS_SERVICE'; + public const SOURCE_MERGE_COMPANIES = 'MERGE_COMPANIES'; + public const SOURCE_SEQUENCES = 'SEQUENCES'; + public const SOURCE_COMPANY_FAMILIES = 'COMPANY_FAMILIES'; + public const SOURCE_MOBILE_IOS = 'MOBILE_IOS'; + public const SOURCE_MOBILE_ANDROID = 'MOBILE_ANDROID'; + public const SOURCE_CONTACTS = 'CONTACTS'; + public const SOURCE_ASSOCIATIONS = 'ASSOCIATIONS'; + public const SOURCE_EXTENSION = 'EXTENSION'; + public const SOURCE_SUCCESS = 'SUCCESS'; + public const SOURCE_BOT = 'BOT'; + public const SOURCE_INTEGRATIONS_SYNC = 'INTEGRATIONS_SYNC'; + public const SOURCE_AUTOMATION_PLATFORM = 'AUTOMATION_PLATFORM'; + public const SOURCE_CONVERSATIONS = 'CONVERSATIONS'; + public const SOURCE_EMAIL_INTEGRATION = 'EMAIL_INTEGRATION'; + public const SOURCE_CONTENT_MEMBERSHIP = 'CONTENT_MEMBERSHIP'; + public const SOURCE_QUOTES = 'QUOTES'; + public const SOURCE_BET_ASSIGNMENT = 'BET_ASSIGNMENT'; + public const SOURCE_QUOTAS = 'QUOTAS'; + public const SOURCE_BET_CRM_CONNECTOR = 'BET_CRM_CONNECTOR'; + public const SOURCE_MEETINGS = 'MEETINGS'; + public const SOURCE_MERGE_OBJECTS = 'MERGE_OBJECTS'; + public const SOURCE_RECYCLING_BIN = 'RECYCLING_BIN'; + public const SOURCE_ADS = 'ADS'; + public const SOURCE_AI_GROUP = 'AI_GROUP'; + public const SOURCE_COMMUNICATOR = 'COMMUNICATOR'; + public const SOURCE_SETTINGS = 'SETTINGS'; + public const SOURCE_PROPERTY_SETTINGS = 'PROPERTY_SETTINGS'; + public const SOURCE_PIPELINE_SETTINGS = 'PIPELINE_SETTINGS'; + public const SOURCE_COMPANY_INSIGHTS = 'COMPANY_INSIGHTS'; + public const SOURCE_BEHAVIORAL_EVENTS = 'BEHAVIORAL_EVENTS'; + public const SOURCE_PAYMENTS = 'PAYMENTS'; + public const SOURCE_GOALS = 'GOALS'; + public const SOURCE_PORTAL_OBJECT_SYNC = 'PORTAL_OBJECT_SYNC'; + public const SOURCE_APPROVALS = 'APPROVALS'; + public const SOURCE_FILE_MANAGER = 'FILE_MANAGER'; + public const SOURCE_MARKETPLACE = 'MARKETPLACE'; + public const SOURCE_INTERNAL_PROCESSING = 'INTERNAL_PROCESSING'; + public const SOURCE_FORECASTING = 'FORECASTING'; + public const SOURCE_SLACK_INTEGRATION = 'SLACK_INTEGRATION'; + public const SOURCE_CRM_UI_BULK_ACTION = 'CRM_UI_BULK_ACTION'; + public const SOURCE_WORKFLOW_CONTACT_DELETE_ACTION = 'WORKFLOW_CONTACT_DELETE_ACTION'; + public const SOURCE_ACCEPTANCE_TEST = 'ACCEPTANCE_TEST'; + public const SOURCE_PLAYBOOKS = 'PLAYBOOKS'; + public const SOURCE_CHATSPOT = 'CHATSPOT'; + public const SOURCE_FLYWHEEL_PRODUCT_DATA_SYNC = 'FLYWHEEL_PRODUCT_DATA_SYNC'; + public const SOURCE_HELP_DESK = 'HELP_DESK'; + public const SOURCE_BILLING = 'BILLING'; + public const SOURCE_DATA_ENRICHMENT = 'DATA_ENRICHMENT'; + public const SOURCE_AUTOMATION_JOURNEY = 'AUTOMATION_JOURNEY'; + public const SOURCE_MICROAPPS = 'MICROAPPS'; + public const SOURCE_INTENT = 'INTENT'; + public const SOURCE_PROSPECTING_AGENT = 'PROSPECTING_AGENT'; + public const DATA_SENSITIVITY_NONE = 'none'; + public const DATA_SENSITIVITY_STANDARD = 'standard'; + public const DATA_SENSITIVITY_HIGH = 'high'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSourceAllowableValues() + { + return [ + self::SOURCE_UNKNOWN, + self::SOURCE_IMPORT, + self::SOURCE_API, + self::SOURCE_FORM, + self::SOURCE_ANALYTICS, + self::SOURCE_MIGRATION, + self::SOURCE_SALESFORCE, + self::SOURCE_INTEGRATION, + self::SOURCE_CONTACTS_WEB, + self::SOURCE_WAL_INCREMENTAL, + self::SOURCE_TASK, + self::SOURCE_EMAIL, + self::SOURCE_WORKFLOWS, + self::SOURCE_CALCULATED, + self::SOURCE_SOCIAL, + self::SOURCE_BATCH_UPDATE, + self::SOURCE_SIGNALS, + self::SOURCE_BIDEN, + self::SOURCE__DEFAULT, + self::SOURCE_COMPANIES, + self::SOURCE_DEALS, + self::SOURCE_ASSISTS, + self::SOURCE_PRESENTATIONS, + self::SOURCE_TALLY, + self::SOURCE_SIDEKICK, + self::SOURCE_CRM_UI, + self::SOURCE_MERGE_CONTACTS, + self::SOURCE_PORTAL_USER_ASSOCIATOR, + self::SOURCE_INTEGRATIONS_PLATFORM, + self::SOURCE_BCC_TO_CRM, + self::SOURCE_FORWARD_TO_CRM, + self::SOURCE_ENGAGEMENTS, + self::SOURCE_SALES, + self::SOURCE_HEISENBERG, + self::SOURCE_LEADIN, + self::SOURCE_GMAIL_INTEGRATION, + self::SOURCE_ACADEMY, + self::SOURCE_SALES_MESSAGES, + self::SOURCE_AVATARS_SERVICE, + self::SOURCE_MERGE_COMPANIES, + self::SOURCE_SEQUENCES, + self::SOURCE_COMPANY_FAMILIES, + self::SOURCE_MOBILE_IOS, + self::SOURCE_MOBILE_ANDROID, + self::SOURCE_CONTACTS, + self::SOURCE_ASSOCIATIONS, + self::SOURCE_EXTENSION, + self::SOURCE_SUCCESS, + self::SOURCE_BOT, + self::SOURCE_INTEGRATIONS_SYNC, + self::SOURCE_AUTOMATION_PLATFORM, + self::SOURCE_CONVERSATIONS, + self::SOURCE_EMAIL_INTEGRATION, + self::SOURCE_CONTENT_MEMBERSHIP, + self::SOURCE_QUOTES, + self::SOURCE_BET_ASSIGNMENT, + self::SOURCE_QUOTAS, + self::SOURCE_BET_CRM_CONNECTOR, + self::SOURCE_MEETINGS, + self::SOURCE_MERGE_OBJECTS, + self::SOURCE_RECYCLING_BIN, + self::SOURCE_ADS, + self::SOURCE_AI_GROUP, + self::SOURCE_COMMUNICATOR, + self::SOURCE_SETTINGS, + self::SOURCE_PROPERTY_SETTINGS, + self::SOURCE_PIPELINE_SETTINGS, + self::SOURCE_COMPANY_INSIGHTS, + self::SOURCE_BEHAVIORAL_EVENTS, + self::SOURCE_PAYMENTS, + self::SOURCE_GOALS, + self::SOURCE_PORTAL_OBJECT_SYNC, + self::SOURCE_APPROVALS, + self::SOURCE_FILE_MANAGER, + self::SOURCE_MARKETPLACE, + self::SOURCE_INTERNAL_PROCESSING, + self::SOURCE_FORECASTING, + self::SOURCE_SLACK_INTEGRATION, + self::SOURCE_CRM_UI_BULK_ACTION, + self::SOURCE_WORKFLOW_CONTACT_DELETE_ACTION, + self::SOURCE_ACCEPTANCE_TEST, + self::SOURCE_PLAYBOOKS, + self::SOURCE_CHATSPOT, + self::SOURCE_FLYWHEEL_PRODUCT_DATA_SYNC, + self::SOURCE_HELP_DESK, + self::SOURCE_BILLING, + self::SOURCE_DATA_ENRICHMENT, + self::SOURCE_AUTOMATION_JOURNEY, + self::SOURCE_MICROAPPS, + self::SOURCE_INTENT, + self::SOURCE_PROSPECTING_AGENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataSensitivityAllowableValues() + { + return [ + self::DATA_SENSITIVITY_NONE, + self::DATA_SENSITIVITY_STANDARD, + self::DATA_SENSITIVITY_HIGH, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('selected_by_user', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('persistence_timestamp', $data ?? [], null); + $this->setIfExists('source_metadata', $data ?? [], null); + $this->setIfExists('data_sensitivity', $data ?? [], null); + $this->setIfExists('source_vid', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('is_encrypted', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('use_timestamp_as_persistence_timestamp', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('selected_by_user_timestamp', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('is_large_value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['source_id'] === null) { + $invalidProperties[] = "'source_id' can't be null"; + } + if ($this->container['selected_by_user'] === null) { + $invalidProperties[] = "'selected_by_user' can't be null"; + } + if ($this->container['source_label'] === null) { + $invalidProperties[] = "'source_label' can't be null"; + } + if ($this->container['source'] === null) { + $invalidProperties[] = "'source' can't be null"; + } + $allowedValues = $this->getSourceAllowableValues(); + if (!is_null($this->container['source']) && !in_array($this->container['source'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'source', must be one of '%s'", + $this->container['source'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['updated_by_user_id'] === null) { + $invalidProperties[] = "'updated_by_user_id' can't be null"; + } + if ($this->container['persistence_timestamp'] === null) { + $invalidProperties[] = "'persistence_timestamp' can't be null"; + } + if ($this->container['source_metadata'] === null) { + $invalidProperties[] = "'source_metadata' can't be null"; + } + if ($this->container['data_sensitivity'] === null) { + $invalidProperties[] = "'data_sensitivity' can't be null"; + } + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!is_null($this->container['data_sensitivity']) && !in_array($this->container['data_sensitivity'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $this->container['data_sensitivity'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['source_vid'] === null) { + $invalidProperties[] = "'source_vid' can't be null"; + } + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + if ($this->container['request_id'] === null) { + $invalidProperties[] = "'request_id' can't be null"; + } + if ($this->container['is_encrypted'] === null) { + $invalidProperties[] = "'is_encrypted' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['use_timestamp_as_persistence_timestamp'] === null) { + $invalidProperties[] = "'use_timestamp_as_persistence_timestamp' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['selected_by_user_timestamp'] === null) { + $invalidProperties[] = "'selected_by_user_timestamp' can't be null"; + } + if ($this->container['timestamp'] === null) { + $invalidProperties[] = "'timestamp' can't be null"; + } + if ($this->container['is_large_value'] === null) { + $invalidProperties[] = "'is_large_value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets source_id + * + * @return string + */ + public function getSourceId() + { + return $this->container['source_id']; + } + + /** + * Sets source_id + * + * @param string $source_id source_id + * + * @return self + */ + public function setSourceId($source_id) + { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } + $this->container['source_id'] = $source_id; + + return $this; + } + + /** + * Gets selected_by_user + * + * @return bool + */ + public function getSelectedByUser() + { + return $this->container['selected_by_user']; + } + + /** + * Sets selected_by_user + * + * @param bool $selected_by_user selected_by_user + * + * @return self + */ + public function setSelectedByUser($selected_by_user) + { + if (is_null($selected_by_user)) { + throw new \InvalidArgumentException('non-nullable selected_by_user cannot be null'); + } + $this->container['selected_by_user'] = $selected_by_user; + + return $this; + } + + /** + * Gets source_label + * + * @return string + */ + public function getSourceLabel() + { + return $this->container['source_label']; + } + + /** + * Sets source_label + * + * @param string $source_label source_label + * + * @return self + */ + public function setSourceLabel($source_label) + { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } + $this->container['source_label'] = $source_label; + + return $this; + } + + /** + * Gets source + * + * @return string + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } + $allowedValues = $this->getSourceAllowableValues(); + if (!in_array($source, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'source', must be one of '%s'", + $source, + implode("', '", $allowedValues) + ) + ); + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets updated_by_user_id + * + * @return int + */ + public function getUpdatedByUserId() + { + return $this->container['updated_by_user_id']; + } + + /** + * Sets updated_by_user_id + * + * @param int $updated_by_user_id updated_by_user_id + * + * @return self + */ + public function setUpdatedByUserId($updated_by_user_id) + { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } + $this->container['updated_by_user_id'] = $updated_by_user_id; + + return $this; + } + + /** + * Gets persistence_timestamp + * + * @return int + */ + public function getPersistenceTimestamp() + { + return $this->container['persistence_timestamp']; + } + + /** + * Sets persistence_timestamp + * + * @param int $persistence_timestamp persistence_timestamp + * + * @return self + */ + public function setPersistenceTimestamp($persistence_timestamp) + { + if (is_null($persistence_timestamp)) { + throw new \InvalidArgumentException('non-nullable persistence_timestamp cannot be null'); + } + $this->container['persistence_timestamp'] = $persistence_timestamp; + + return $this; + } + + /** + * Gets source_metadata + * + * @return string + */ + public function getSourceMetadata() + { + return $this->container['source_metadata']; + } + + /** + * Sets source_metadata + * + * @param string $source_metadata source_metadata + * + * @return self + */ + public function setSourceMetadata($source_metadata) + { + if (is_null($source_metadata)) { + throw new \InvalidArgumentException('non-nullable source_metadata cannot be null'); + } + $this->container['source_metadata'] = $source_metadata; + + return $this; + } + + /** + * Gets data_sensitivity + * + * @return string + */ + public function getDataSensitivity() + { + return $this->container['data_sensitivity']; + } + + /** + * Sets data_sensitivity + * + * @param string $data_sensitivity data_sensitivity + * + * @return self + */ + public function setDataSensitivity($data_sensitivity) + { + if (is_null($data_sensitivity)) { + throw new \InvalidArgumentException('non-nullable data_sensitivity cannot be null'); + } + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!in_array($data_sensitivity, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $data_sensitivity, + implode("', '", $allowedValues) + ) + ); + } + $this->container['data_sensitivity'] = $data_sensitivity; + + return $this; + } + + /** + * Gets source_vid + * + * @return int[] + */ + public function getSourceVid() + { + return $this->container['source_vid']; + } + + /** + * Sets source_vid + * + * @param int[] $source_vid source_vid + * + * @return self + */ + public function setSourceVid($source_vid) + { + if (is_null($source_vid)) { + throw new \InvalidArgumentException('non-nullable source_vid cannot be null'); + } + $this->container['source_vid'] = $source_vid; + + return $this; + } + + /** + * Gets unit + * + * @return string + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit unit + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + throw new \InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets request_id + * + * @return string + */ + public function getRequestId() + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string $request_id request_id + * + * @return self + */ + public function setRequestId($request_id) + { + if (is_null($request_id)) { + throw new \InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets is_encrypted + * + * @return bool + */ + public function getIsEncrypted() + { + return $this->container['is_encrypted']; + } + + /** + * Sets is_encrypted + * + * @param bool $is_encrypted is_encrypted + * + * @return self + */ + public function setIsEncrypted($is_encrypted) + { + if (is_null($is_encrypted)) { + throw new \InvalidArgumentException('non-nullable is_encrypted cannot be null'); + } + $this->container['is_encrypted'] = $is_encrypted; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets use_timestamp_as_persistence_timestamp + * + * @return bool + */ + public function getUseTimestampAsPersistenceTimestamp() + { + return $this->container['use_timestamp_as_persistence_timestamp']; + } + + /** + * Sets use_timestamp_as_persistence_timestamp + * + * @param bool $use_timestamp_as_persistence_timestamp use_timestamp_as_persistence_timestamp + * + * @return self + */ + public function setUseTimestampAsPersistenceTimestamp($use_timestamp_as_persistence_timestamp) + { + if (is_null($use_timestamp_as_persistence_timestamp)) { + throw new \InvalidArgumentException('non-nullable use_timestamp_as_persistence_timestamp cannot be null'); + } + $this->container['use_timestamp_as_persistence_timestamp'] = $use_timestamp_as_persistence_timestamp; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets selected_by_user_timestamp + * + * @return int + */ + public function getSelectedByUserTimestamp() + { + return $this->container['selected_by_user_timestamp']; + } + + /** + * Sets selected_by_user_timestamp + * + * @param int $selected_by_user_timestamp selected_by_user_timestamp + * + * @return self + */ + public function setSelectedByUserTimestamp($selected_by_user_timestamp) + { + if (is_null($selected_by_user_timestamp)) { + throw new \InvalidArgumentException('non-nullable selected_by_user_timestamp cannot be null'); + } + $this->container['selected_by_user_timestamp'] = $selected_by_user_timestamp; + + return $this; + } + + /** + * Gets timestamp + * + * @return int + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param int $timestamp timestamp + * + * @return self + */ + public function setTimestamp($timestamp) + { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets is_large_value + * + * @return bool + */ + public function getIsLargeValue() + { + return $this->container['is_large_value']; + } + + /** + * Sets is_large_value + * + * @param bool $is_large_value is_large_value + * + * @return self + */ + public function setIsLargeValue($is_large_value) + { + if (is_null($is_large_value)) { + throw new \InvalidArgumentException('non-nullable is_large_value cannot be null'); + } + $this->container['is_large_value'] = $is_large_value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Imports/Model/PublicImportError.php b/codegen/Crm/Imports/Model/PublicImportError.php index a5eb8869c..204bda9e8 100644 --- a/codegen/Crm/Imports/Model/PublicImportError.php +++ b/codegen/Crm/Imports/Model/PublicImportError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -61,7 +61,10 @@ class PublicImportError implements ModelInterface, ArrayAccess, \JsonSerializabl 'extra_context' => 'string', 'object_type_id' => 'string', 'error_type' => 'string', + 'invalid_property_value' => '\HubSpot\Client\Crm\Imports\Model\PropertyValue', + 'error_message' => 'string', 'known_column_number' => 'int', + 'invalid_value_to_display' => 'string', 'id' => 'string', 'source_data' => '\HubSpot\Client\Crm\Imports\Model\ImportRowCore', 'object_type' => 'string', @@ -80,7 +83,10 @@ class PublicImportError implements ModelInterface, ArrayAccess, \JsonSerializabl 'extra_context' => null, 'object_type_id' => null, 'error_type' => null, + 'invalid_property_value' => null, + 'error_message' => null, 'known_column_number' => 'int32', + 'invalid_value_to_display' => null, 'id' => null, 'source_data' => null, 'object_type' => null, @@ -97,7 +103,10 @@ class PublicImportError implements ModelInterface, ArrayAccess, \JsonSerializabl 'extra_context' => false, 'object_type_id' => false, 'error_type' => false, + 'invalid_property_value' => false, + 'error_message' => false, 'known_column_number' => false, + 'invalid_value_to_display' => false, 'id' => false, 'source_data' => false, 'object_type' => false, @@ -194,7 +203,10 @@ public function isNullableSetToNull(string $property): bool 'extra_context' => 'extraContext', 'object_type_id' => 'objectTypeId', 'error_type' => 'errorType', + 'invalid_property_value' => 'invalidPropertyValue', + 'error_message' => 'errorMessage', 'known_column_number' => 'knownColumnNumber', + 'invalid_value_to_display' => 'invalidValueToDisplay', 'id' => 'id', 'source_data' => 'sourceData', 'object_type' => 'objectType', @@ -211,7 +223,10 @@ public function isNullableSetToNull(string $property): bool 'extra_context' => 'setExtraContext', 'object_type_id' => 'setObjectTypeId', 'error_type' => 'setErrorType', + 'invalid_property_value' => 'setInvalidPropertyValue', + 'error_message' => 'setErrorMessage', 'known_column_number' => 'setKnownColumnNumber', + 'invalid_value_to_display' => 'setInvalidValueToDisplay', 'id' => 'setId', 'source_data' => 'setSourceData', 'object_type' => 'setObjectType', @@ -228,7 +243,10 @@ public function isNullableSetToNull(string $property): bool 'extra_context' => 'getExtraContext', 'object_type_id' => 'getObjectTypeId', 'error_type' => 'getErrorType', + 'invalid_property_value' => 'getInvalidPropertyValue', + 'error_message' => 'getErrorMessage', 'known_column_number' => 'getKnownColumnNumber', + 'invalid_value_to_display' => 'getInvalidValueToDisplay', 'id' => 'getId', 'source_data' => 'getSourceData', 'object_type' => 'getObjectType', @@ -296,6 +314,7 @@ public function getModelName() public const ERROR_TYPE_AMBIGUOUS_ENUMERATION_OPTION = 'AMBIGUOUS_ENUMERATION_OPTION'; public const ERROR_TYPE_FAILED_VALIDATION = 'FAILED_VALIDATION'; public const ERROR_TYPE_FAILED_TO_CREATE_ASSOCIATION = 'FAILED_TO_CREATE_ASSOCIATION'; + public const ERROR_TYPE_ASSOCIATION_LIMIT_EXCEEDED = 'ASSOCIATION_LIMIT_EXCEEDED'; public const ERROR_TYPE_FILE_NOT_FOUND = 'FILE_NOT_FOUND'; public const ERROR_TYPE_INVALID_COLUMN_CONFIGURATION = 'INVALID_COLUMN_CONFIGURATION'; public const ERROR_TYPE_INVALID_FILE_TYPE = 'INVALID_FILE_TYPE'; @@ -309,6 +328,7 @@ public function getModelName() public const ERROR_TYPE_PORTAL_WIDE_CUSTOM_OBJECT_LIMIT_EXCEEDED = 'PORTAL_WIDE_CUSTOM_OBJECT_LIMIT_EXCEEDED'; public const ERROR_TYPE_INVALID_ALTERNATE_ID = 'INVALID_ALTERNATE_ID'; public const ERROR_TYPE_INVALID_EMAIL = 'INVALID_EMAIL'; + public const ERROR_TYPE_SECONDARY_EMAIL_WRITE_FAILURE = 'SECONDARY_EMAIL_WRITE_FAILURE'; public const ERROR_TYPE_INVALID_DOMAIN = 'INVALID_DOMAIN'; public const ERROR_TYPE_DUPLICATE_ROW_CONTENT = 'DUPLICATE_ROW_CONTENT'; public const ERROR_TYPE_INVALID_NUMBER_SIZE = 'INVALID_NUMBER_SIZE'; @@ -319,7 +339,6 @@ public function getModelName() public const ERROR_TYPE_DUPLICATE_ALTERNATE_ID = 'DUPLICATE_ALTERNATE_ID'; public const ERROR_TYPE_DUPLICATE_OBJECT_ID = 'DUPLICATE_OBJECT_ID'; public const ERROR_TYPE_DUPLICATE_UNIQUE_PROPERTY_VALUE = 'DUPLICATE_UNIQUE_PROPERTY_VALUE'; - public const ERROR_TYPE_BLANK_VALUE_PROVIDED = 'BLANK_VALUE_PROVIDED'; public const ERROR_TYPE_UNKNOWN_ASSOCIATION_RECORD_ID = 'UNKNOWN_ASSOCIATION_RECORD_ID'; public const ERROR_TYPE_INVALID_RECORD_ID = 'INVALID_RECORD_ID'; public const ERROR_TYPE_DUPLICATE_RECORD_ID = 'DUPLICATE_RECORD_ID'; @@ -328,10 +347,16 @@ public function getModelName() public const ERROR_TYPE_UPDATE_ONLY_IMPORT = 'UPDATE_ONLY_IMPORT'; public const ERROR_TYPE_COLUMN_TOO_LARGE = 'COLUMN_TOO_LARGE'; public const ERROR_TYPE_ROW_DATA_TOO_LARGE = 'ROW_DATA_TOO_LARGE'; + public const ERROR_TYPE_MISSING_EVENT_TIMESTAMP = 'MISSING_EVENT_TIMESTAMP'; public const ERROR_TYPE_INVALID_EVENT_TIMESTAMP = 'INVALID_EVENT_TIMESTAMP'; public const ERROR_TYPE_INVALID_EVENT = 'INVALID_EVENT'; public const ERROR_TYPE_DUPLICATE_EVENT = 'DUPLICATE_EVENT'; public const ERROR_TYPE_MISSING_EVENT_DEFINITION = 'MISSING_EVENT_DEFINITION'; + public const ERROR_TYPE_INVALID_ASSOCIATION_KEY = 'INVALID_ASSOCIATION_KEY'; + public const ERROR_TYPE_ASSOCIATION_RECORD_NOT_FOUND = 'ASSOCIATION_RECORD_NOT_FOUND'; + public const ERROR_TYPE_MISSING_OBJECT_DEFINITION = 'MISSING_OBJECT_DEFINITION'; + public const ERROR_TYPE_ASSOCIATION_LABEL_NOT_FOUND = 'ASSOCIATION_LABEL_NOT_FOUND'; + public const ERROR_TYPE_MANY_ERRORS_IN_ROW = 'MANY_ERRORS_IN_ROW'; public const OBJECT_TYPE_CONTACT = 'CONTACT'; public const OBJECT_TYPE_COMPANY = 'COMPANY'; public const OBJECT_TYPE_DEAL = 'DEAL'; @@ -477,6 +502,21 @@ public function getModelName() public const OBJECT_TYPE_ALL_PAGES = 'ALL_PAGES'; public const OBJECT_TYPE_AI_FORECAST = 'AI_FORECAST'; public const OBJECT_TYPE_CRM_PIPELINES_DUMMY_TYPE = 'CRM_PIPELINES_DUMMY_TYPE'; + public const OBJECT_TYPE_KNOWLEDGE_ARTICLE = 'KNOWLEDGE_ARTICLE'; + public const OBJECT_TYPE_PROPERTY_INFO = 'PROPERTY_INFO'; + public const OBJECT_TYPE_DATA_PRIVACY_CONSENT = 'DATA_PRIVACY_CONSENT'; + public const OBJECT_TYPE_GOAL_TEMPLATE = 'GOAL_TEMPLATE'; + public const OBJECT_TYPE_SCORE_CONFIGURATION = 'SCORE_CONFIGURATION'; + public const OBJECT_TYPE_AUDIENCE = 'AUDIENCE'; + public const OBJECT_TYPE_PARTNER_CLIENT_REVENUE = 'PARTNER_CLIENT_REVENUE'; + public const OBJECT_TYPE_AUTOMATION_JOURNEY = 'AUTOMATION_JOURNEY'; + public const OBJECT_TYPE_COMBO_EVENT_CONFIGURATION = 'COMBO_EVENT_CONFIGURATION'; + public const OBJECT_TYPE_CRM_OBJECTS_DUMMY_TYPE = 'CRM_OBJECTS_DUMMY_TYPE'; + public const OBJECT_TYPE_CASE_STUDY = 'CASE_STUDY'; + public const OBJECT_TYPE_SERVICE = 'SERVICE'; + public const OBJECT_TYPE_PODCAST_EPISODE = 'PODCAST_EPISODE'; + public const OBJECT_TYPE_PARTNER_SERVICE = 'PARTNER_SERVICE'; + public const OBJECT_TYPE_PROSPECTING_AGENT_CONTACT_ASSIGNMENT = 'PROSPECTING_AGENT_CONTACT_ASSIGNMENT'; public const OBJECT_TYPE_UNKNOWN = 'UNKNOWN'; /** @@ -507,6 +547,7 @@ public function getErrorTypeAllowableValues() self::ERROR_TYPE_AMBIGUOUS_ENUMERATION_OPTION, self::ERROR_TYPE_FAILED_VALIDATION, self::ERROR_TYPE_FAILED_TO_CREATE_ASSOCIATION, + self::ERROR_TYPE_ASSOCIATION_LIMIT_EXCEEDED, self::ERROR_TYPE_FILE_NOT_FOUND, self::ERROR_TYPE_INVALID_COLUMN_CONFIGURATION, self::ERROR_TYPE_INVALID_FILE_TYPE, @@ -520,6 +561,7 @@ public function getErrorTypeAllowableValues() self::ERROR_TYPE_PORTAL_WIDE_CUSTOM_OBJECT_LIMIT_EXCEEDED, self::ERROR_TYPE_INVALID_ALTERNATE_ID, self::ERROR_TYPE_INVALID_EMAIL, + self::ERROR_TYPE_SECONDARY_EMAIL_WRITE_FAILURE, self::ERROR_TYPE_INVALID_DOMAIN, self::ERROR_TYPE_DUPLICATE_ROW_CONTENT, self::ERROR_TYPE_INVALID_NUMBER_SIZE, @@ -530,7 +572,6 @@ public function getErrorTypeAllowableValues() self::ERROR_TYPE_DUPLICATE_ALTERNATE_ID, self::ERROR_TYPE_DUPLICATE_OBJECT_ID, self::ERROR_TYPE_DUPLICATE_UNIQUE_PROPERTY_VALUE, - self::ERROR_TYPE_BLANK_VALUE_PROVIDED, self::ERROR_TYPE_UNKNOWN_ASSOCIATION_RECORD_ID, self::ERROR_TYPE_INVALID_RECORD_ID, self::ERROR_TYPE_DUPLICATE_RECORD_ID, @@ -539,10 +580,16 @@ public function getErrorTypeAllowableValues() self::ERROR_TYPE_UPDATE_ONLY_IMPORT, self::ERROR_TYPE_COLUMN_TOO_LARGE, self::ERROR_TYPE_ROW_DATA_TOO_LARGE, + self::ERROR_TYPE_MISSING_EVENT_TIMESTAMP, self::ERROR_TYPE_INVALID_EVENT_TIMESTAMP, self::ERROR_TYPE_INVALID_EVENT, self::ERROR_TYPE_DUPLICATE_EVENT, self::ERROR_TYPE_MISSING_EVENT_DEFINITION, + self::ERROR_TYPE_INVALID_ASSOCIATION_KEY, + self::ERROR_TYPE_ASSOCIATION_RECORD_NOT_FOUND, + self::ERROR_TYPE_MISSING_OBJECT_DEFINITION, + self::ERROR_TYPE_ASSOCIATION_LABEL_NOT_FOUND, + self::ERROR_TYPE_MANY_ERRORS_IN_ROW, ]; } @@ -699,6 +746,21 @@ public function getObjectTypeAllowableValues() self::OBJECT_TYPE_ALL_PAGES, self::OBJECT_TYPE_AI_FORECAST, self::OBJECT_TYPE_CRM_PIPELINES_DUMMY_TYPE, + self::OBJECT_TYPE_KNOWLEDGE_ARTICLE, + self::OBJECT_TYPE_PROPERTY_INFO, + self::OBJECT_TYPE_DATA_PRIVACY_CONSENT, + self::OBJECT_TYPE_GOAL_TEMPLATE, + self::OBJECT_TYPE_SCORE_CONFIGURATION, + self::OBJECT_TYPE_AUDIENCE, + self::OBJECT_TYPE_PARTNER_CLIENT_REVENUE, + self::OBJECT_TYPE_AUTOMATION_JOURNEY, + self::OBJECT_TYPE_COMBO_EVENT_CONFIGURATION, + self::OBJECT_TYPE_CRM_OBJECTS_DUMMY_TYPE, + self::OBJECT_TYPE_CASE_STUDY, + self::OBJECT_TYPE_SERVICE, + self::OBJECT_TYPE_PODCAST_EPISODE, + self::OBJECT_TYPE_PARTNER_SERVICE, + self::OBJECT_TYPE_PROSPECTING_AGENT_CONTACT_ASSIGNMENT, self::OBJECT_TYPE_UNKNOWN, ]; } @@ -713,16 +775,19 @@ public function getObjectTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('extra_context', $data ?? [], null); $this->setIfExists('object_type_id', $data ?? [], null); $this->setIfExists('error_type', $data ?? [], null); + $this->setIfExists('invalid_property_value', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); $this->setIfExists('known_column_number', $data ?? [], null); + $this->setIfExists('invalid_value_to_display', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('source_data', $data ?? [], null); $this->setIfExists('object_type', $data ?? [], null); @@ -919,6 +984,60 @@ public function setErrorType($error_type) return $this; } + /** + * Gets invalid_property_value + * + * @return \HubSpot\Client\Crm\Imports\Model\PropertyValue|null + */ + public function getInvalidPropertyValue() + { + return $this->container['invalid_property_value']; + } + + /** + * Sets invalid_property_value + * + * @param \HubSpot\Client\Crm\Imports\Model\PropertyValue|null $invalid_property_value invalid_property_value + * + * @return self + */ + public function setInvalidPropertyValue($invalid_property_value) + { + if (is_null($invalid_property_value)) { + throw new \InvalidArgumentException('non-nullable invalid_property_value cannot be null'); + } + $this->container['invalid_property_value'] = $invalid_property_value; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage() + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message error_message + * + * @return self + */ + public function setErrorMessage($error_message) + { + if (is_null($error_message)) { + throw new \InvalidArgumentException('non-nullable error_message cannot be null'); + } + $this->container['error_message'] = $error_message; + + return $this; + } + /** * Gets known_column_number * @@ -946,6 +1065,33 @@ public function setKnownColumnNumber($known_column_number) return $this; } + /** + * Gets invalid_value_to_display + * + * @return string|null + */ + public function getInvalidValueToDisplay() + { + return $this->container['invalid_value_to_display']; + } + + /** + * Sets invalid_value_to_display + * + * @param string|null $invalid_value_to_display invalid_value_to_display + * + * @return self + */ + public function setInvalidValueToDisplay($invalid_value_to_display) + { + if (is_null($invalid_value_to_display)) { + throw new \InvalidArgumentException('non-nullable invalid_value_to_display cannot be null'); + } + $this->container['invalid_value_to_display'] = $invalid_value_to_display; + + return $this; + } + /** * Gets id * diff --git a/codegen/Crm/Imports/Model/PublicImportMetadata.php b/codegen/Crm/Imports/Model/PublicImportMetadata.php index 0b7fd1a20..fcf59413d 100644 --- a/codegen/Crm/Imports/Model/PublicImportMetadata.php +++ b/codegen/Crm/Imports/Model/PublicImportMetadata.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -35,7 +35,6 @@ * PublicImportMetadata Class Doc Comment * * @category Class - * @description An object detailing a summary of the import record outputs * @package HubSpot\Client\Crm\Imports * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -252,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('counters', $data ?? [], null); $this->setIfExists('file_ids', $data ?? [], null); diff --git a/codegen/Crm/Imports/Model/PublicImportResponse.php b/codegen/Crm/Imports/Model/PublicImportResponse.php index 88f04f75f..50b6bfec2 100644 --- a/codegen/Crm/Imports/Model/PublicImportResponse.php +++ b/codegen/Crm/Imports/Model/PublicImportResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -35,7 +35,6 @@ * PublicImportResponse Class Doc Comment * * @category Class - * @description A current summary of the import, whether complete or not. * @package HubSpot\Client\Crm\Imports * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -67,6 +66,7 @@ class PublicImportResponse implements ModelInterface, ArrayAccess, \JsonSerializ 'state' => 'string', 'id' => 'string', 'opt_out_import' => 'bool', + 'mapped_object_type_ids' => 'string[]', 'updated_at' => '\DateTime' ]; @@ -87,6 +87,7 @@ class PublicImportResponse implements ModelInterface, ArrayAccess, \JsonSerializ 'state' => null, 'id' => null, 'opt_out_import' => null, + 'mapped_object_type_ids' => null, 'updated_at' => 'date-time' ]; @@ -105,6 +106,7 @@ class PublicImportResponse implements ModelInterface, ArrayAccess, \JsonSerializ 'state' => false, 'id' => false, 'opt_out_import' => false, + 'mapped_object_type_ids' => false, 'updated_at' => false ]; @@ -203,6 +205,7 @@ public function isNullableSetToNull(string $property): bool 'state' => 'state', 'id' => 'id', 'opt_out_import' => 'optOutImport', + 'mapped_object_type_ids' => 'mappedObjectTypeIds', 'updated_at' => 'updatedAt' ]; @@ -221,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'state' => 'setState', 'id' => 'setId', 'opt_out_import' => 'setOptOutImport', + 'mapped_object_type_ids' => 'setMappedObjectTypeIds', 'updated_at' => 'setUpdatedAt' ]; @@ -239,6 +243,7 @@ public function isNullableSetToNull(string $property): bool 'state' => 'getState', 'id' => 'getId', 'opt_out_import' => 'getOptOutImport', + 'mapped_object_type_ids' => 'getMappedObjectTypeIds', 'updated_at' => 'getUpdatedAt' ]; @@ -342,10 +347,10 @@ public function getStateAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('import_template', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -356,6 +361,7 @@ public function __construct(array $data = null) $this->setIfExists('state', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('opt_out_import', $data ?? [], null); + $this->setIfExists('mapped_object_type_ids', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -419,6 +425,9 @@ public function listInvalidProperties() if ($this->container['opt_out_import'] === null) { $invalidProperties[] = "'opt_out_import' can't be null"; } + if ($this->container['mapped_object_type_ids'] === null) { + $invalidProperties[] = "'mapped_object_type_ids' can't be null"; + } if ($this->container['updated_at'] === null) { $invalidProperties[] = "'updated_at' can't be null"; } @@ -700,6 +709,33 @@ public function setOptOutImport($opt_out_import) return $this; } + /** + * Gets mapped_object_type_ids + * + * @return string[] + */ + public function getMappedObjectTypeIds() + { + return $this->container['mapped_object_type_ids']; + } + + /** + * Sets mapped_object_type_ids + * + * @param string[] $mapped_object_type_ids mapped_object_type_ids + * + * @return self + */ + public function setMappedObjectTypeIds($mapped_object_type_ids) + { + if (is_null($mapped_object_type_ids)) { + throw new \InvalidArgumentException('non-nullable mapped_object_type_ids cannot be null'); + } + $this->container['mapped_object_type_ids'] = $mapped_object_type_ids; + + return $this; + } + /** * Gets updated_at * diff --git a/codegen/Crm/Imports/Model/PublicObjectListRecord.php b/codegen/Crm/Imports/Model/PublicObjectListRecord.php index b59402468..7d3069d92 100644 --- a/codegen/Crm/Imports/Model/PublicObjectListRecord.php +++ b/codegen/Crm/Imports/Model/PublicObjectListRecord.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -35,7 +35,6 @@ * PublicObjectListRecord Class Doc Comment * * @category Class - * @description A summary detailing which list contains the imported objects. * @package HubSpot\Client\Crm\Imports * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -246,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_id', $data ?? [], null); $this->setIfExists('object_type', $data ?? [], null); diff --git a/codegen/Crm/Imports/ObjectSerializer.php b/codegen/Crm/Imports/ObjectSerializer.php index 83b8ec77f..2b3390d4f 100644 --- a/codegen/Crm/Imports/ObjectSerializer.php +++ b/codegen/Crm/Imports/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/LineItems/Api/BasicApi.php b/codegen/Crm/LineItems/Api/BasicApi.php index 7f010e772..752c5528e 100644 --- a/codegen/Crm/LineItems/Api/BasicApi.php +++ b/codegen/Crm/LineItems/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($line_item_id, string $contentType = self::c $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $line_item_id line_item_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($line_item_id, $properties = null, $properties_with_hist * Read * * @param string $line_item_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($line_item_id, $properties = null, $properti $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($line_item_id, $properties = null, $properti ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($line_item_id, $properties = null, $properti * Read * * @param string $line_item_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $line_item_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $line_item_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($line_item_id, $properties = null, $properties_wi * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $line_item_id line_item_id (required) * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($line_item_id, $simple_public_object_input, $id_property * * @param string $line_item_id (required) * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($line_item_id, $simple_public_object_input, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($line_item_id, $simple_public_object_input, $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($line_item_id, $simple_public_object_input, $ * * @param string $line_item_id (required) * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $line_item_id (required) * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $line_item_id (required) * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/LineItems/Api/BatchApi.php b/codegen/Crm/LineItems/Api/BatchApi.php index 7cc7fe078..b1f86c4d3 100644 --- a/codegen/Crm/LineItems/Api/BatchApi.php +++ b/codegen/Crm/LineItems/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of line items * - * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\LineItems\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of line items * - * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\LineItems\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of line items * - * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of line items * - * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\LineItems\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of line items by internal ID, or unique property values * * @param \HubSpot\Client\Crm\LineItems\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of line items by internal ID, or unique property values * * @param \HubSpot\Client\Crm\LineItems\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\LineItems\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of line items by internal ID, or unique property values * * @param \HubSpot\Client\Crm\LineItems\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of line items by internal ID, or unique property values * * @param \HubSpot\Client\Crm\LineItems\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\LineItems\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/LineItems/Api/SearchApi.php b/codegen/Crm/LineItems/Api/SearchApi.php index bbee4667c..7a718d1a3 100644 --- a/codegen/Crm/LineItems/Api/SearchApi.php +++ b/codegen/Crm/LineItems/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for line items + * * @param \HubSpot\Client\Crm\LineItems\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for line items + * * @param \HubSpot\Client\Crm\LineItems\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\LineItems\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for line items + * * @param \HubSpot\Client\Crm\LineItems\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for line items + * * @param \HubSpot\Client\Crm\LineItems\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 * diff --git a/codegen/Crm/LineItems/ApiException.php b/codegen/Crm/LineItems/ApiException.php index 0f56042a9..e6b135200 100644 --- a/codegen/Crm/LineItems/ApiException.php +++ b/codegen/Crm/LineItems/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/LineItems/Configuration.php b/codegen/Crm/LineItems/Configuration.php index 5629f6582..92e8f24f9 100644 --- a/codegen/Crm/LineItems/Configuration.php +++ b/codegen/Crm/LineItems/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/LineItems/HeaderSelector.php b/codegen/Crm/LineItems/HeaderSelector.php index 6bdff0014..0f33d31f5 100644 --- a/codegen/Crm/LineItems/HeaderSelector.php +++ b/codegen/Crm/LineItems/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/LineItems/Model/AssociatedId.php b/codegen/Crm/LineItems/Model/AssociatedId.php index 9bbb9ce6b..501bc2219 100644 --- a/codegen/Crm/LineItems/Model/AssociatedId.php +++ b/codegen/Crm/LineItems/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/AssociationSpec.php b/codegen/Crm/LineItems/Model/AssociationSpec.php index 86d12e8ac..eec2b60fa 100644 --- a/codegen/Crm/LineItems/Model/AssociationSpec.php +++ b/codegen/Crm/LineItems/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInput.php index f3aaf3e44..c9ae29e4e 100644 --- a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 54c6c2ece..9dd90e3fb 100644 --- a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\LineItems\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index e744db0b6..4f1f513e2 100644 --- a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectId.php index 65cabe718..6d012804d 100644 --- a/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/LineItems/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php index 67de4db0b..ea244f550 100644 --- a/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/LineItems/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php index c84e0ec7d..11c23e10f 100644 --- a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObjectWithErrors.php index 27e554701..67f74a37d 100644 --- a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php index 883024770..1ecfed051 100644 --- a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 6cbe01c05..8ecbfa5ba 100644 --- a/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/LineItems/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/CollectionResponseAssociatedId.php b/codegen/Crm/LineItems/Model/CollectionResponseAssociatedId.php index 174e4cf13..801acc6d2 100644 --- a/codegen/Crm/LineItems/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/LineItems/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index f35c009de..60a0a7462 100644 --- a/codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/LineItems/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/LineItems/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 3cf4241c1..31c88d1f8 100644 --- a/codegen/Crm/LineItems/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/LineItems/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/Error.php b/codegen/Crm/LineItems/Model/Error.php index e609a3027..b9b393b32 100644 --- a/codegen/Crm/LineItems/Model/Error.php +++ b/codegen/Crm/LineItems/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/ErrorDetail.php b/codegen/Crm/LineItems/Model/ErrorDetail.php index 460c51559..34c67f59f 100644 --- a/codegen/Crm/LineItems/Model/ErrorDetail.php +++ b/codegen/Crm/LineItems/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/Filter.php b/codegen/Crm/LineItems/Model/Filter.php index 432147745..41233a404 100644 --- a/codegen/Crm/LineItems/Model/Filter.php +++ b/codegen/Crm/LineItems/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/FilterGroup.php b/codegen/Crm/LineItems/Model/FilterGroup.php index b9f18bd40..4aa98cb04 100644 --- a/codegen/Crm/LineItems/Model/FilterGroup.php +++ b/codegen/Crm/LineItems/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/LineItems/Model/ForwardPaging.php b/codegen/Crm/LineItems/Model/ForwardPaging.php index c34383854..7d9642d14 100644 --- a/codegen/Crm/LineItems/Model/ForwardPaging.php +++ b/codegen/Crm/LineItems/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/LineItems/Model/ModelInterface.php b/codegen/Crm/LineItems/Model/ModelInterface.php index 0749ca229..bf55d5147 100644 --- a/codegen/Crm/LineItems/Model/ModelInterface.php +++ b/codegen/Crm/LineItems/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/LineItems/Model/NextPage.php b/codegen/Crm/LineItems/Model/NextPage.php index 106404d2c..0e421728f 100644 --- a/codegen/Crm/LineItems/Model/NextPage.php +++ b/codegen/Crm/LineItems/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/Paging.php b/codegen/Crm/LineItems/Model/Paging.php index 42c2bda75..1cd2df66c 100644 --- a/codegen/Crm/LineItems/Model/Paging.php +++ b/codegen/Crm/LineItems/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/PreviousPage.php b/codegen/Crm/LineItems/Model/PreviousPage.php index f67be4d62..e1ef3747f 100644 --- a/codegen/Crm/LineItems/Model/PreviousPage.php +++ b/codegen/Crm/LineItems/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/PublicAssociationsForObject.php b/codegen/Crm/LineItems/Model/PublicAssociationsForObject.php index 78b89a20d..05b0e8cfc 100644 --- a/codegen/Crm/LineItems/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/LineItems/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/PublicObjectId.php b/codegen/Crm/LineItems/Model/PublicObjectId.php index 79d9e995e..7c4136b79 100644 --- a/codegen/Crm/LineItems/Model/PublicObjectId.php +++ b/codegen/Crm/LineItems/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/LineItems/Model/PublicObjectSearchRequest.php b/codegen/Crm/LineItems/Model/PublicObjectSearchRequest.php index a76e3cc2b..7429b73e7 100644 --- a/codegen/Crm/LineItems/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/LineItems/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/SimplePublicObject.php b/codegen/Crm/LineItems/Model/SimplePublicObject.php index d604afe33..da402d2d5 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObject.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInput.php index 08ce6db98..cbfea873b 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..07cd92eef --- /dev/null +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputUpsert.php index 87d907597..8b4143275 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectId.php b/codegen/Crm/LineItems/Model/SimplePublicObjectId.php index 0866c397d..09b8f208e 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectId.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php b/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php index 728d3b34c..0fa68ad17 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php index 374e6eddd..ce828e983 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\LineItems\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php index 4a82e82cc..a2289cafe 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/LineItems/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/LineItems/Model/SimplePublicUpsertObject.php b/codegen/Crm/LineItems/Model/SimplePublicUpsertObject.php index bf5e64c99..635ded5e8 100644 --- a/codegen/Crm/LineItems/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/LineItems/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/LineItems/Model/StandardError.php b/codegen/Crm/LineItems/Model/StandardError.php index 66d7fb477..a85d2b192 100644 --- a/codegen/Crm/LineItems/Model/StandardError.php +++ b/codegen/Crm/LineItems/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/LineItems/Model/ValueWithTimestamp.php b/codegen/Crm/LineItems/Model/ValueWithTimestamp.php index 546dc0d29..b477af2c3 100644 --- a/codegen/Crm/LineItems/Model/ValueWithTimestamp.php +++ b/codegen/Crm/LineItems/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/LineItems/ObjectSerializer.php b/codegen/Crm/LineItems/ObjectSerializer.php index 67d1cdc4b..827abe3ae 100644 --- a/codegen/Crm/LineItems/ObjectSerializer.php +++ b/codegen/Crm/LineItems/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Lists/Api/FoldersApi.php b/codegen/Crm/Lists/Api/FoldersApi.php index bd9677e95..e325959d0 100644 --- a/codegen/Crm/Lists/Api/FoldersApi.php +++ b/codegen/Crm/Lists/Api/FoldersApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -98,13 +98,13 @@ class FoldersApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -193,18 +193,6 @@ public function createWithHttpInfo($list_folder_create_request, string $contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -263,6 +251,19 @@ public function createWithHttpInfo($list_folder_create_request, string $contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderCreateResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -487,7 +488,7 @@ public function createRequest($list_folder_create_request, string $contentType = * * Retrieves a folder. * - * @param string $folder_id The Id of the folder to retrieve. (optional, default to '0') + * @param string|null $folder_id The Id of the folder to retrieve. (optional, default to '0') * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -505,7 +506,7 @@ public function getAll($folder_id = '0', string $contentType = self::contentType * * Retrieves a folder. * - * @param string $folder_id The Id of the folder to retrieve. (optional, default to '0') + * @param string|null $folder_id The Id of the folder to retrieve. (optional, default to '0') * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -538,18 +539,6 @@ public function getAllWithHttpInfo($folder_id = '0', string $contentType = self: $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -608,6 +597,19 @@ public function getAllWithHttpInfo($folder_id = '0', string $contentType = self: ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -664,7 +666,7 @@ public function getAllWithHttpInfo($folder_id = '0', string $contentType = self: * * Retrieves a folder. * - * @param string $folder_id The Id of the folder to retrieve. (optional, default to '0') + * @param string|null $folder_id The Id of the folder to retrieve. (optional, default to '0') * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -685,7 +687,7 @@ function ($response) { * * Retrieves a folder. * - * @param string $folder_id The Id of the folder to retrieve. (optional, default to '0') + * @param string|null $folder_id The Id of the folder to retrieve. (optional, default to '0') * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -735,7 +737,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $folder_id The Id of the folder to retrieve. (optional, default to '0') + * @param string|null $folder_id The Id of the folder to retrieve. (optional, default to '0') * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -881,18 +883,6 @@ public function moveWithHttpInfo($folder_id, $new_parent_folder_id, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -951,6 +941,19 @@ public function moveWithHttpInfo($folder_id, $new_parent_folder_id, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1244,18 +1247,6 @@ public function moveListWithHttpInfo($list_move_request, string $contentType = s $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1484,18 +1475,6 @@ public function removeWithHttpInfo($folder_id, string $contentType = self::conte $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1676,7 +1655,7 @@ public function removeRequest($folder_id, string $contentType = self::contentTyp * Rename a folder * * @param string $folder_id (required) - * @param string $new_folder_name (optional) + * @param string|null $new_folder_name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rename'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1695,7 +1674,7 @@ public function rename($folder_id, $new_folder_name = null, string $contentType * Rename a folder * * @param string $folder_id (required) - * @param string $new_folder_name (optional) + * @param string|null $new_folder_name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rename'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1728,18 +1707,6 @@ public function renameWithHttpInfo($folder_id, $new_folder_name = null, string $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1798,6 +1765,19 @@ public function renameWithHttpInfo($folder_id, $new_folder_name = null, string $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFolderFetchResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1855,7 +1835,7 @@ public function renameWithHttpInfo($folder_id, $new_folder_name = null, string $ * Rename a folder * * @param string $folder_id (required) - * @param string $new_folder_name (optional) + * @param string|null $new_folder_name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rename'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1877,7 +1857,7 @@ function ($response) { * Rename a folder * * @param string $folder_id (required) - * @param string $new_folder_name (optional) + * @param string|null $new_folder_name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rename'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1928,7 +1908,7 @@ function ($exception) { * Create request for operation 'rename' * * @param string $folder_id (required) - * @param string $new_folder_name (optional) + * @param string|null $new_folder_name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rename'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Lists/Api/ListsApi.php b/codegen/Crm/Lists/Api/ListsApi.php index 30aa99a88..9af84d456 100644 --- a/codegen/Crm/Lists/Api/ListsApi.php +++ b/codegen/Crm/Lists/Api/ListsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -107,13 +107,13 @@ class ListsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -202,18 +202,6 @@ public function createWithHttpInfo($list_create_request, string $contentType = s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -272,6 +260,19 @@ public function createWithHttpInfo($list_create_request, string $contentType = s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListCreateResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -547,18 +548,6 @@ public function doSearchWithHttpInfo($list_search_request, string $contentType = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -617,6 +606,19 @@ public function doSearchWithHttpInfo($list_search_request, string $contentType = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListSearchResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -841,8 +843,8 @@ public function doSearchRequest($list_search_request, string $contentType = self * * Fetch Multiple Lists * - * @param string[] $list_ids The **ILS IDs** of the lists to fetch. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string[]|null $list_ids The **ILS IDs** of the lists to fetch. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -860,8 +862,8 @@ public function getAll($list_ids = null, $include_filters = false, string $conte * * Fetch Multiple Lists * - * @param string[] $list_ids The **ILS IDs** of the lists to fetch. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string[]|null $list_ids The **ILS IDs** of the lists to fetch. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -894,18 +896,6 @@ public function getAllWithHttpInfo($list_ids = null, $include_filters = false, s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -964,6 +954,19 @@ public function getAllWithHttpInfo($list_ids = null, $include_filters = false, s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListsByIdResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1020,8 +1023,8 @@ public function getAllWithHttpInfo($list_ids = null, $include_filters = false, s * * Fetch Multiple Lists * - * @param string[] $list_ids The **ILS IDs** of the lists to fetch. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string[]|null $list_ids The **ILS IDs** of the lists to fetch. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1042,8 +1045,8 @@ function ($response) { * * Fetch Multiple Lists * - * @param string[] $list_ids The **ILS IDs** of the lists to fetch. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string[]|null $list_ids The **ILS IDs** of the lists to fetch. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1093,8 +1096,8 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string[] $list_ids The **ILS IDs** of the lists to fetch. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string[]|null $list_ids The **ILS IDs** of the lists to fetch. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definitions should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1198,7 +1201,7 @@ public function getAllRequest($list_ids = null, $include_filters = false, string * Fetch List by ID * * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1217,7 +1220,7 @@ public function getById($list_id, $include_filters = false, string $contentType * Fetch List by ID * * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1250,18 +1253,6 @@ public function getByIdWithHttpInfo($list_id, $include_filters = false, string $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1320,6 +1311,19 @@ public function getByIdWithHttpInfo($list_id, $include_filters = false, string $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1377,7 +1381,7 @@ public function getByIdWithHttpInfo($list_id, $include_filters = false, string $ * Fetch List by ID * * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1399,7 +1403,7 @@ function ($response) { * Fetch List by ID * * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1450,7 +1454,7 @@ function ($exception) { * Create request for operation 'getById' * * @param string $list_id The **ILS ID** of the list to fetch. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1560,7 +1564,7 @@ public function getByIdRequest($list_id, $include_filters = false, string $conte * * @param string $list_name The name of the list to fetch. This is **not** case sensitive. (required) * @param string $object_type_id The object type ID of the object types stored by the list to fetch. For example, `0-1` for a `CONTACT` list. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1580,7 +1584,7 @@ public function getByName($list_name, $object_type_id, $include_filters = false, * * @param string $list_name The name of the list to fetch. This is **not** case sensitive. (required) * @param string $object_type_id The object type ID of the object types stored by the list to fetch. For example, `0-1` for a `CONTACT` list. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1613,18 +1617,6 @@ public function getByNameWithHttpInfo($list_name, $object_type_id, $include_filt $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1683,6 +1675,19 @@ public function getByNameWithHttpInfo($list_name, $object_type_id, $include_filt ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListFetchResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1741,7 +1746,7 @@ public function getByNameWithHttpInfo($list_name, $object_type_id, $include_filt * * @param string $list_name The name of the list to fetch. This is **not** case sensitive. (required) * @param string $object_type_id The object type ID of the object types stored by the list to fetch. For example, `0-1` for a `CONTACT` list. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1764,7 +1769,7 @@ function ($response) { * * @param string $list_name The name of the list to fetch. This is **not** case sensitive. (required) * @param string $object_type_id The object type ID of the object types stored by the list to fetch. For example, `0-1` for a `CONTACT` list. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1816,7 +1821,7 @@ function ($exception) { * * @param string $list_name The name of the list to fetch. This is **not** case sensitive. (required) * @param string $object_type_id The object type ID of the object types stored by the list to fetch. For example, `0-1` for a `CONTACT` list. (required) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1989,18 +1994,6 @@ public function removeWithHttpInfo($list_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -2230,18 +2223,6 @@ public function restoreWithHttpInfo($list_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -2423,7 +2404,7 @@ public function restoreRequest($list_id, string $contentType = self::contentType * * @param string $list_id The **ILS ID** of the list to update. (required) * @param \HubSpot\Client\Crm\Lists\Model\ListFilterUpdateRequest $list_filter_update_request list_filter_update_request (required) - * @param bool $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) + * @param bool|null $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateListFilters'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -2443,7 +2424,7 @@ public function updateListFilters($list_id, $list_filter_update_request, $enroll * * @param string $list_id The **ILS ID** of the list to update. (required) * @param \HubSpot\Client\Crm\Lists\Model\ListFilterUpdateRequest $list_filter_update_request (required) - * @param bool $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) + * @param bool|null $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateListFilters'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -2476,18 +2457,6 @@ public function updateListFiltersWithHttpInfo($list_id, $list_filter_update_requ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2546,6 +2515,19 @@ public function updateListFiltersWithHttpInfo($list_id, $list_filter_update_requ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2604,7 +2586,7 @@ public function updateListFiltersWithHttpInfo($list_id, $list_filter_update_requ * * @param string $list_id The **ILS ID** of the list to update. (required) * @param \HubSpot\Client\Crm\Lists\Model\ListFilterUpdateRequest $list_filter_update_request (required) - * @param bool $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) + * @param bool|null $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateListFilters'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2627,7 +2609,7 @@ function ($response) { * * @param string $list_id The **ILS ID** of the list to update. (required) * @param \HubSpot\Client\Crm\Lists\Model\ListFilterUpdateRequest $list_filter_update_request (required) - * @param bool $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) + * @param bool|null $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateListFilters'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2679,7 +2661,7 @@ function ($exception) { * * @param string $list_id The **ILS ID** of the list to update. (required) * @param \HubSpot\Client\Crm\Lists\Model\ListFilterUpdateRequest $list_filter_update_request (required) - * @param bool $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) + * @param bool|null $enroll_objects_in_workflows A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateListFilters'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2802,8 +2784,8 @@ public function updateListFiltersRequest($list_id, $list_filter_update_request, * Update List Name * * @param string $list_id The **ILS ID** of the list to update. (required) - * @param string $list_name The name to update the list to. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string|null $list_name The name to update the list to. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -2822,8 +2804,8 @@ public function updateName($list_id, $list_name = null, $include_filters = false * Update List Name * * @param string $list_id The **ILS ID** of the list to update. (required) - * @param string $list_name The name to update the list to. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string|null $list_name The name to update the list to. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -2856,18 +2838,6 @@ public function updateNameWithHttpInfo($list_id, $list_name = null, $include_fil $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2926,6 +2896,19 @@ public function updateNameWithHttpInfo($list_id, $list_name = null, $include_fil ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ListUpdateResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2983,8 +2966,8 @@ public function updateNameWithHttpInfo($list_id, $list_name = null, $include_fil * Update List Name * * @param string $list_id The **ILS ID** of the list to update. (required) - * @param string $list_name The name to update the list to. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string|null $list_name The name to update the list to. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3006,8 +2989,8 @@ function ($response) { * Update List Name * * @param string $list_id The **ILS ID** of the list to update. (required) - * @param string $list_name The name to update the list to. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string|null $list_name The name to update the list to. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3058,8 +3041,8 @@ function ($exception) { * Create request for operation 'updateName' * * @param string $list_id The **ILS ID** of the list to update. (required) - * @param string $list_name The name to update the list to. (optional) - * @param bool $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) + * @param string|null $list_name The name to update the list to. (optional) + * @param bool|null $include_filters A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateName'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Lists/Api/MappingApi.php b/codegen/Crm/Lists/Api/MappingApi.php index a0b2b4e8c..17190f36c 100644 --- a/codegen/Crm/Lists/Api/MappingApi.php +++ b/codegen/Crm/Lists/Api/MappingApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class MappingApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -130,7 +130,7 @@ public function getConfig() * * Translate Legacy List Id to Modern List Id * - * @param string $legacy_list_id The legacy list id from lists v1 API. (optional) + * @param string|null $legacy_list_id The legacy list id from lists v1 API. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListId'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -148,7 +148,7 @@ public function translateLegacyListIdToListId($legacy_list_id = null, string $co * * Translate Legacy List Id to Modern List Id * - * @param string $legacy_list_id The legacy list id from lists v1 API. (optional) + * @param string|null $legacy_list_id The legacy list id from lists v1 API. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListId'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -181,18 +181,6 @@ public function translateLegacyListIdToListIdWithHttpInfo($legacy_list_id = null $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -251,6 +239,19 @@ public function translateLegacyListIdToListIdWithHttpInfo($legacy_list_id = null ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\PublicMigrationMapping'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -307,7 +308,7 @@ public function translateLegacyListIdToListIdWithHttpInfo($legacy_list_id = null * * Translate Legacy List Id to Modern List Id * - * @param string $legacy_list_id The legacy list id from lists v1 API. (optional) + * @param string|null $legacy_list_id The legacy list id from lists v1 API. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -328,7 +329,7 @@ function ($response) { * * Translate Legacy List Id to Modern List Id * - * @param string $legacy_list_id The legacy list id from lists v1 API. (optional) + * @param string|null $legacy_list_id The legacy list id from lists v1 API. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -378,7 +379,7 @@ function ($exception) { /** * Create request for operation 'translateLegacyListIdToListId' * - * @param string $legacy_list_id The legacy list id from lists v1 API. (optional) + * @param string|null $legacy_list_id The legacy list id from lists v1 API. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['translateLegacyListIdToListId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -522,18 +523,6 @@ public function translateLegacyListIdToListIdBatchWithHttpInfo($request_body, st $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -592,6 +581,19 @@ public function translateLegacyListIdToListIdBatchWithHttpInfo($request_body, st ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\PublicBatchMigrationMapping'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Lists/Api/MembershipsApi.php b/codegen/Crm/Lists/Api/MembershipsApi.php index 0f4d7eed6..71587dfa9 100644 --- a/codegen/Crm/Lists/Api/MembershipsApi.php +++ b/codegen/Crm/Lists/Api/MembershipsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -104,13 +104,13 @@ class MembershipsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -201,18 +201,6 @@ public function addWithHttpInfo($list_id, $request_body, string $contentType = s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -271,6 +259,19 @@ public function addWithHttpInfo($list_id, $request_body, string $contentType = s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -565,18 +566,6 @@ public function addAllFromListWithHttpInfo($list_id, $source_list_id, string $co $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -827,18 +816,6 @@ public function addAndRemoveWithHttpInfo($list_id, $membership_change_request, s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -897,6 +874,19 @@ public function addAndRemoveWithHttpInfo($list_id, $membership_change_request, s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1192,18 +1182,6 @@ public function getListsWithHttpInfo($object_type_id, $record_id, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1262,6 +1240,19 @@ public function getListsWithHttpInfo($object_type_id, $record_id, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseRecordListMembershipNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1506,9 +1497,9 @@ public function getListsRequest($object_type_id, $record_id, string $contentType * Fetch List Memberships Ordered by ID * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1527,9 +1518,9 @@ public function getPage($list_id, $after = null, $before = null, $limit = 100, s * Fetch List Memberships Ordered by ID * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1562,18 +1553,6 @@ public function getPageWithHttpInfo($list_id, $after = null, $before = null, $li $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1632,6 +1611,19 @@ public function getPageWithHttpInfo($list_id, $after = null, $before = null, $li ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1689,9 +1681,9 @@ public function getPageWithHttpInfo($list_id, $after = null, $before = null, $li * Fetch List Memberships Ordered by ID * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1713,9 +1705,9 @@ function ($response) { * Fetch List Memberships Ordered by ID * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1766,9 +1758,9 @@ function ($exception) { * Create request for operation 'getPage' * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1897,9 +1889,9 @@ public function getPageRequest($list_id, $after = null, $before = null, $limit = * Fetch List Memberships Ordered by Added to List Date * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageOrderedByAddedToListDate'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1918,9 +1910,9 @@ public function getPageOrderedByAddedToListDate($list_id, $after = null, $before * Fetch List Memberships Ordered by Added to List Date * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageOrderedByAddedToListDate'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Lists\ApiException on non-2xx response or if the response body is not in the expected format @@ -1953,18 +1945,6 @@ public function getPageOrderedByAddedToListDateWithHttpInfo($list_id, $after = n $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2023,6 +2003,19 @@ public function getPageOrderedByAddedToListDateWithHttpInfo($list_id, $after = n ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\ApiCollectionResponseJoinTimeAndRecordId'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2080,9 +2073,9 @@ public function getPageOrderedByAddedToListDateWithHttpInfo($list_id, $after = n * Fetch List Memberships Ordered by Added to List Date * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageOrderedByAddedToListDate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2104,9 +2097,9 @@ function ($response) { * Fetch List Memberships Ordered by Added to List Date * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageOrderedByAddedToListDate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2157,9 +2150,9 @@ function ($exception) { * Create request for operation 'getPageOrderedByAddedToListDate' * * @param string $list_id The **ILS ID** of the list. (required) - * @param string $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) - * @param string $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) - * @param int $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) + * @param string|null $after The paging offset token for the page that comes `after` the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the `before` offset. (optional) + * @param string|null $before The paging offset token for the page that comes `before` the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order. (optional) + * @param int|null $limit The number of records to return in the response. The maximum `limit` is 250. (optional, default to 100) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPageOrderedByAddedToListDate'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2340,18 +2333,6 @@ public function removeWithHttpInfo($list_id, $request_body, string $contentType $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2410,6 +2391,19 @@ public function removeWithHttpInfo($list_id, $request_body, string $contentType ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Lists\Model\MembershipsUpdateResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2702,18 +2696,6 @@ public function removeAllWithHttpInfo($list_id, string $contentType = self::cont $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; diff --git a/codegen/Crm/Lists/ApiException.php b/codegen/Crm/Lists/ApiException.php index cc23b1af5..0dce58194 100644 --- a/codegen/Crm/Lists/ApiException.php +++ b/codegen/Crm/Lists/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Lists/Configuration.php b/codegen/Crm/Lists/Configuration.php index 0530aaf58..b85d7727a 100644 --- a/codegen/Crm/Lists/Configuration.php +++ b/codegen/Crm/Lists/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Lists/HeaderSelector.php b/codegen/Crm/Lists/HeaderSelector.php index 401261e4b..e8efc2ae8 100644 --- a/codegen/Crm/Lists/HeaderSelector.php +++ b/codegen/Crm/Lists/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Lists/Model/ApiCollectionResponseJoinTimeAndRecordId.php b/codegen/Crm/Lists/Model/ApiCollectionResponseJoinTimeAndRecordId.php index 2470e39e3..015812272 100644 --- a/codegen/Crm/Lists/Model/ApiCollectionResponseJoinTimeAndRecordId.php +++ b/codegen/Crm/Lists/Model/ApiCollectionResponseJoinTimeAndRecordId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php b/codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php index babde4d66..d90345880 100644 --- a/codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php +++ b/codegen/Crm/Lists/Model/ApiCollectionResponseRecordListMembershipNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/Error.php b/codegen/Crm/Lists/Model/Error.php index 8892e5d2e..0fda51f1c 100644 --- a/codegen/Crm/Lists/Model/Error.php +++ b/codegen/Crm/Lists/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ErrorDetail.php b/codegen/Crm/Lists/Model/ErrorDetail.php index c458878e0..f77be6f10 100644 --- a/codegen/Crm/Lists/Model/ErrorDetail.php +++ b/codegen/Crm/Lists/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/JoinTimeAndRecordId.php b/codegen/Crm/Lists/Model/JoinTimeAndRecordId.php index 9ee5359ea..a67393277 100644 --- a/codegen/Crm/Lists/Model/JoinTimeAndRecordId.php +++ b/codegen/Crm/Lists/Model/JoinTimeAndRecordId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('record_id', $data ?? [], null); $this->setIfExists('membership_timestamp', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ListCreateRequest.php b/codegen/Crm/Lists/Model/ListCreateRequest.php index 08101f24b..5a4d76fc0 100644 --- a/codegen/Crm/Lists/Model/ListCreateRequest.php +++ b/codegen/Crm/Lists/Model/ListCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_type_id', $data ?? [], null); $this->setIfExists('processing_type', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ListCreateResponse.php b/codegen/Crm/Lists/Model/ListCreateResponse.php index 0c4c3a42a..60960eb9d 100644 --- a/codegen/Crm/Lists/Model/ListCreateResponse.php +++ b/codegen/Crm/Lists/Model/ListCreateResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list', $data ?? [], null); } diff --git a/codegen/Crm/Lists/Model/ListFetchResponse.php b/codegen/Crm/Lists/Model/ListFetchResponse.php index 32ceae680..57257c3eb 100644 --- a/codegen/Crm/Lists/Model/ListFetchResponse.php +++ b/codegen/Crm/Lists/Model/ListFetchResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list', $data ?? [], null); } diff --git a/codegen/Crm/Lists/Model/ListFilterUpdateRequest.php b/codegen/Crm/Lists/Model/ListFilterUpdateRequest.php index 9442540ee..47b7f3e07 100644 --- a/codegen/Crm/Lists/Model/ListFilterUpdateRequest.php +++ b/codegen/Crm/Lists/Model/ListFilterUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch', $data ?? [], null); } diff --git a/codegen/Crm/Lists/Model/ListFolderCreateRequest.php b/codegen/Crm/Lists/Model/ListFolderCreateRequest.php index ade8fd8b5..fda62e204 100644 --- a/codegen/Crm/Lists/Model/ListFolderCreateRequest.php +++ b/codegen/Crm/Lists/Model/ListFolderCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ListFolderCreateResponse.php b/codegen/Crm/Lists/Model/ListFolderCreateResponse.php index 3ddec2c69..a5290f0a9 100644 --- a/codegen/Crm/Lists/Model/ListFolderCreateResponse.php +++ b/codegen/Crm/Lists/Model/ListFolderCreateResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('folder', $data ?? [], null); } diff --git a/codegen/Crm/Lists/Model/ListFolderFetchResponse.php b/codegen/Crm/Lists/Model/ListFolderFetchResponse.php index 86b9b8e46..f16cdaa5f 100644 --- a/codegen/Crm/Lists/Model/ListFolderFetchResponse.php +++ b/codegen/Crm/Lists/Model/ListFolderFetchResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('folder', $data ?? [], null); } diff --git a/codegen/Crm/Lists/Model/ListMoveRequest.php b/codegen/Crm/Lists/Model/ListMoveRequest.php index b24fd9fdd..9142ffb3d 100644 --- a/codegen/Crm/Lists/Model/ListMoveRequest.php +++ b/codegen/Crm/Lists/Model/ListMoveRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_id', $data ?? [], null); $this->setIfExists('new_folder_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ListSearchRequest.php b/codegen/Crm/Lists/Model/ListSearchRequest.php index 72ad1dbf4..364f1a2ac 100644 --- a/codegen/Crm/Lists/Model/ListSearchRequest.php +++ b/codegen/Crm/Lists/Model/ListSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_ids', $data ?? [], null); $this->setIfExists('offset', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ListSearchResponse.php b/codegen/Crm/Lists/Model/ListSearchResponse.php index b34a98a9b..4b6f71947 100644 --- a/codegen/Crm/Lists/Model/ListSearchResponse.php +++ b/codegen/Crm/Lists/Model/ListSearchResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('offset', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ListUpdateResponse.php b/codegen/Crm/Lists/Model/ListUpdateResponse.php index cef0bb72b..459887306 100644 --- a/codegen/Crm/Lists/Model/ListUpdateResponse.php +++ b/codegen/Crm/Lists/Model/ListUpdateResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('updated_list', $data ?? [], null); } diff --git a/codegen/Crm/Lists/Model/ListsByIdResponse.php b/codegen/Crm/Lists/Model/ListsByIdResponse.php index 6d782f10f..1ab862470 100644 --- a/codegen/Crm/Lists/Model/ListsByIdResponse.php +++ b/codegen/Crm/Lists/Model/ListsByIdResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('lists', $data ?? [], null); } diff --git a/codegen/Crm/Lists/Model/MembershipChangeRequest.php b/codegen/Crm/Lists/Model/MembershipChangeRequest.php index eca7f677e..0c96a9363 100644 --- a/codegen/Crm/Lists/Model/MembershipChangeRequest.php +++ b/codegen/Crm/Lists/Model/MembershipChangeRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('record_ids_to_remove', $data ?? [], null); $this->setIfExists('record_ids_to_add', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/MembershipsUpdateResponse.php b/codegen/Crm/Lists/Model/MembershipsUpdateResponse.php index a340384c3..484199ad5 100644 --- a/codegen/Crm/Lists/Model/MembershipsUpdateResponse.php +++ b/codegen/Crm/Lists/Model/MembershipsUpdateResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('record_ids_removed', $data ?? [], null); $this->setIfExists('records_ids_added', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/ModelInterface.php b/codegen/Crm/Lists/Model/ModelInterface.php index ac25b9649..7b97b91a1 100644 --- a/codegen/Crm/Lists/Model/ModelInterface.php +++ b/codegen/Crm/Lists/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Lists/Model/NextPage.php b/codegen/Crm/Lists/Model/NextPage.php index 0f2dd856b..0fb89f2bb 100644 --- a/codegen/Crm/Lists/Model/NextPage.php +++ b/codegen/Crm/Lists/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/Paging.php b/codegen/Crm/Lists/Model/Paging.php index dcb93cd4d..4098cb017 100644 --- a/codegen/Crm/Lists/Model/Paging.php +++ b/codegen/Crm/Lists/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PreviousPage.php b/codegen/Crm/Lists/Model/PreviousPage.php index 1687edee9..ec6ee1839 100644 --- a/codegen/Crm/Lists/Model/PreviousPage.php +++ b/codegen/Crm/Lists/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicAbsoluteComparativeTimestampRefineBy.php b/codegen/Crm/Lists/Model/PublicAbsoluteComparativeTimestampRefineBy.php index ac14b1627..e4dda9c2d 100644 --- a/codegen/Crm/Lists/Model/PublicAbsoluteComparativeTimestampRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicAbsoluteComparativeTimestampRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('comparison', $data ?? [], null); $this->setIfExists('type', $data ?? [], 'ABSOLUTE_COMPARATIVE'); diff --git a/codegen/Crm/Lists/Model/PublicAbsoluteRangedTimestampRefineBy.php b/codegen/Crm/Lists/Model/PublicAbsoluteRangedTimestampRefineBy.php index 7f19b21ed..9ad0db076 100644 --- a/codegen/Crm/Lists/Model/PublicAbsoluteRangedTimestampRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicAbsoluteRangedTimestampRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('range_type', $data ?? [], null); $this->setIfExists('upper_timestamp', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicAdsSearchFilter.php b/codegen/Crm/Lists/Model/PublicAdsSearchFilter.php index d09bdb579..d59e7cc61 100644 --- a/codegen/Crm/Lists/Model/PublicAdsSearchFilter.php +++ b/codegen/Crm/Lists/Model/PublicAdsSearchFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('search_terms', $data ?? [], null); $this->setIfExists('entity_type', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicAdsTimeFilter.php b/codegen/Crm/Lists/Model/PublicAdsTimeFilter.php index eb3be3174..1a38af3a9 100644 --- a/codegen/Crm/Lists/Model/PublicAdsTimeFilter.php +++ b/codegen/Crm/Lists/Model/PublicAdsTimeFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('pruning_refine_by', $data ?? [], null); $this->setIfExists('filter_type', $data ?? [], 'ADS_TIME'); diff --git a/codegen/Crm/Lists/Model/PublicAllHistoryRefineBy.php b/codegen/Crm/Lists/Model/PublicAllHistoryRefineBy.php index d4aa3585a..0a07ad75f 100644 --- a/codegen/Crm/Lists/Model/PublicAllHistoryRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicAllHistoryRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type', $data ?? [], 'ALL_HISTORY'); } diff --git a/codegen/Crm/Lists/Model/PublicAllPropertyTypesOperation.php b/codegen/Crm/Lists/Model/PublicAllPropertyTypesOperation.php index da4702baf..52c4312a1 100644 --- a/codegen/Crm/Lists/Model/PublicAllPropertyTypesOperation.php +++ b/codegen/Crm/Lists/Model/PublicAllPropertyTypesOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('operation_type', $data ?? [], 'ALL_PROPERTY'); diff --git a/codegen/Crm/Lists/Model/PublicAndFilterBranch.php b/codegen/Crm/Lists/Model/PublicAndFilterBranch.php index 365a6e6c0..60d9370d9 100644 --- a/codegen/Crm/Lists/Model/PublicAndFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicAndFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'AND'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicAssociationFilterBranch.php b/codegen/Crm/Lists/Model/PublicAssociationFilterBranch.php index 9bea3d217..e0af40d13 100644 --- a/codegen/Crm/Lists/Model/PublicAssociationFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicAssociationFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -294,10 +294,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'ASSOCIATION'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicAssociationInListFilter.php b/codegen/Crm/Lists/Model/PublicAssociationInListFilter.php index 3dec8266a..7d6d45f1a 100644 --- a/codegen/Crm/Lists/Model/PublicAssociationInListFilter.php +++ b/codegen/Crm/Lists/Model/PublicAssociationInListFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -294,10 +294,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_id', $data ?? [], null); $this->setIfExists('coalescing_refine_by', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicBatchMigrationMapping.php b/codegen/Crm/Lists/Model/PublicBatchMigrationMapping.php index beb158249..034af7033 100644 --- a/codegen/Crm/Lists/Model/PublicBatchMigrationMapping.php +++ b/codegen/Crm/Lists/Model/PublicBatchMigrationMapping.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('legacy_list_ids_to_ids_mapping', $data ?? [], null); $this->setIfExists('missing_legacy_list_ids', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicBoolPropertyOperation.php b/codegen/Crm/Lists/Model/PublicBoolPropertyOperation.php index 8cc356bff..678f61e2e 100644 --- a/codegen/Crm/Lists/Model/PublicBoolPropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicBoolPropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('operation_type', $data ?? [], 'BOOL'); diff --git a/codegen/Crm/Lists/Model/PublicCalendarDatePropertyOperation.php b/codegen/Crm/Lists/Model/PublicCalendarDatePropertyOperation.php index c37441792..16052be7e 100644 --- a/codegen/Crm/Lists/Model/PublicCalendarDatePropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicCalendarDatePropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -323,10 +323,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('use_fiscal_year', $data ?? [], null); $this->setIfExists('fiscal_year_start', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicCampaignInfluencedFilter.php b/codegen/Crm/Lists/Model/PublicCampaignInfluencedFilter.php index fc3917207..f7ef6e2de 100644 --- a/codegen/Crm/Lists/Model/PublicCampaignInfluencedFilter.php +++ b/codegen/Crm/Lists/Model/PublicCampaignInfluencedFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('campaign_id', $data ?? [], null); $this->setIfExists('filter_type', $data ?? [], 'CAMPAIGN_INFLUENCED'); diff --git a/codegen/Crm/Lists/Model/PublicCommunicationSubscriptionFilter.php b/codegen/Crm/Lists/Model/PublicCommunicationSubscriptionFilter.php index 16b1ee700..1cec5290f 100644 --- a/codegen/Crm/Lists/Model/PublicCommunicationSubscriptionFilter.php +++ b/codegen/Crm/Lists/Model/PublicCommunicationSubscriptionFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('subscription_type', $data ?? [], null); $this->setIfExists('subscription_ids', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicComparativeDatePropertyOperation.php b/codegen/Crm/Lists/Model/PublicComparativeDatePropertyOperation.php index 40cde5a4c..2e073dab8 100644 --- a/codegen/Crm/Lists/Model/PublicComparativeDatePropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicComparativeDatePropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('default_comparison_value', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicComparativePropertyUpdatedOperation.php b/codegen/Crm/Lists/Model/PublicComparativePropertyUpdatedOperation.php index a14b27665..8dc95d997 100644 --- a/codegen/Crm/Lists/Model/PublicComparativePropertyUpdatedOperation.php +++ b/codegen/Crm/Lists/Model/PublicComparativePropertyUpdatedOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('default_comparison_value', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicConstantFilter.php b/codegen/Crm/Lists/Model/PublicConstantFilter.php index 08fa7e48d..43678315c 100644 --- a/codegen/Crm/Lists/Model/PublicConstantFilter.php +++ b/codegen/Crm/Lists/Model/PublicConstantFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('should_accept', $data ?? [], null); $this->setIfExists('source', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicCtaAnalyticsFilter.php b/codegen/Crm/Lists/Model/PublicCtaAnalyticsFilter.php index e58542019..a98611ff7 100644 --- a/codegen/Crm/Lists/Model/PublicCtaAnalyticsFilter.php +++ b/codegen/Crm/Lists/Model/PublicCtaAnalyticsFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('coalescing_refine_by', $data ?? [], null); $this->setIfExists('pruning_refine_by', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicDatePoint.php b/codegen/Crm/Lists/Model/PublicDatePoint.php index 4beaefc5f..d052e4b63 100644 --- a/codegen/Crm/Lists/Model/PublicDatePoint.php +++ b/codegen/Crm/Lists/Model/PublicDatePoint.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -306,10 +306,10 @@ public function getTimeTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('month', $data ?? [], null); $this->setIfExists('hour', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicDatePropertyOperation.php b/codegen/Crm/Lists/Model/PublicDatePropertyOperation.php index 17551bca4..0e6b06e06 100644 --- a/codegen/Crm/Lists/Model/PublicDatePropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicDatePropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('month', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicDateTimePropertyOperation.php b/codegen/Crm/Lists/Model/PublicDateTimePropertyOperation.php index 1e27495e1..9be8dc453 100644 --- a/codegen/Crm/Lists/Model/PublicDateTimePropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicDateTimePropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('requires_time_zone_conversion', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicEmailEventFilter.php b/codegen/Crm/Lists/Model/PublicEmailEventFilter.php index 7b8a2b8d0..98b06e522 100644 --- a/codegen/Crm/Lists/Model/PublicEmailEventFilter.php +++ b/codegen/Crm/Lists/Model/PublicEmailEventFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -325,10 +325,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('click_url', $data ?? [], null); $this->setIfExists('level', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicEmailSubscriptionFilter.php b/codegen/Crm/Lists/Model/PublicEmailSubscriptionFilter.php index 8f4159a9e..7e6ffdad2 100644 --- a/codegen/Crm/Lists/Model/PublicEmailSubscriptionFilter.php +++ b/codegen/Crm/Lists/Model/PublicEmailSubscriptionFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('subscription_type', $data ?? [], null); $this->setIfExists('subscription_ids', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicEnumerationPropertyOperation.php b/codegen/Crm/Lists/Model/PublicEnumerationPropertyOperation.php index 2c2d1105b..5953d15ef 100644 --- a/codegen/Crm/Lists/Model/PublicEnumerationPropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicEnumerationPropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('values', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicEventAnalyticsFilter.php b/codegen/Crm/Lists/Model/PublicEventAnalyticsFilter.php index a544f0a67..e2af48840 100644 --- a/codegen/Crm/Lists/Model/PublicEventAnalyticsFilter.php +++ b/codegen/Crm/Lists/Model/PublicEventAnalyticsFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_id', $data ?? [], null); $this->setIfExists('coalescing_refine_by', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicEventFilterMetadata.php b/codegen/Crm/Lists/Model/PublicEventFilterMetadata.php index b8fb14763..871495bcd 100644 --- a/codegen/Crm/Lists/Model/PublicEventFilterMetadata.php +++ b/codegen/Crm/Lists/Model/PublicEventFilterMetadata.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('property', $data ?? [], null); $this->setIfExists('operation', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicFiscalQuarterReference.php b/codegen/Crm/Lists/Model/PublicFiscalQuarterReference.php index f8233e687..0cc0b9f2e 100644 --- a/codegen/Crm/Lists/Model/PublicFiscalQuarterReference.php +++ b/codegen/Crm/Lists/Model/PublicFiscalQuarterReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('month', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicFiscalYearReference.php b/codegen/Crm/Lists/Model/PublicFiscalYearReference.php index 783f9f339..d35a9ea79 100644 --- a/codegen/Crm/Lists/Model/PublicFiscalYearReference.php +++ b/codegen/Crm/Lists/Model/PublicFiscalYearReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('month', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicFormSubmissionFilter.php b/codegen/Crm/Lists/Model/PublicFormSubmissionFilter.php index 246718588..2741e17fd 100644 --- a/codegen/Crm/Lists/Model/PublicFormSubmissionFilter.php +++ b/codegen/Crm/Lists/Model/PublicFormSubmissionFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -291,10 +291,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('form_id', $data ?? [], null); $this->setIfExists('coalescing_refine_by', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php b/codegen/Crm/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php index 1005e387e..48bed7add 100644 --- a/codegen/Crm/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicFormSubmissionFilterCoalescingRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -365,10 +365,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('max_occurrences', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicFormSubmissionOnPageFilter.php b/codegen/Crm/Lists/Model/PublicFormSubmissionOnPageFilter.php index 65b8fc600..d5808701d 100644 --- a/codegen/Crm/Lists/Model/PublicFormSubmissionOnPageFilter.php +++ b/codegen/Crm/Lists/Model/PublicFormSubmissionOnPageFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -297,10 +297,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('form_id', $data ?? [], null); $this->setIfExists('coalescing_refine_by', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicInListFilter.php b/codegen/Crm/Lists/Model/PublicInListFilter.php index 22820272e..6d93a437c 100644 --- a/codegen/Crm/Lists/Model/PublicInListFilter.php +++ b/codegen/Crm/Lists/Model/PublicInListFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_id', $data ?? [], null); $this->setIfExists('metadata', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicInListFilterMetadata.php b/codegen/Crm/Lists/Model/PublicInListFilterMetadata.php index a11e455ce..71ecc6276 100644 --- a/codegen/Crm/Lists/Model/PublicInListFilterMetadata.php +++ b/codegen/Crm/Lists/Model/PublicInListFilterMetadata.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('in_list_type', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicIndexOffset.php b/codegen/Crm/Lists/Model/PublicIndexOffset.php index f4183f78b..3133005aa 100644 --- a/codegen/Crm/Lists/Model/PublicIndexOffset.php +++ b/codegen/Crm/Lists/Model/PublicIndexOffset.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('milliseconds', $data ?? [], null); $this->setIfExists('hours', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicIndexedTimePoint.php b/codegen/Crm/Lists/Model/PublicIndexedTimePoint.php index f3cd97a94..5f85f49ad 100644 --- a/codegen/Crm/Lists/Model/PublicIndexedTimePoint.php +++ b/codegen/Crm/Lists/Model/PublicIndexedTimePoint.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getTimeTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('offset', $data ?? [], null); $this->setIfExists('timezone_source', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicIndexedTimePointIndexReference.php b/codegen/Crm/Lists/Model/PublicIndexedTimePointIndexReference.php index 38f17d307..d65d82865 100644 --- a/codegen/Crm/Lists/Model/PublicIndexedTimePointIndexReference.php +++ b/codegen/Crm/Lists/Model/PublicIndexedTimePointIndexReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -319,10 +319,10 @@ public function getDayOfWeekAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('millisecond', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicIntegrationEventFilter.php b/codegen/Crm/Lists/Model/PublicIntegrationEventFilter.php index 73b6f78df..79664ed98 100644 --- a/codegen/Crm/Lists/Model/PublicIntegrationEventFilter.php +++ b/codegen/Crm/Lists/Model/PublicIntegrationEventFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_type_id', $data ?? [], null); $this->setIfExists('filter_lines', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicListFolder.php b/codegen/Crm/Lists/Model/PublicListFolder.php index 042d9a96d..b50edc36e 100644 --- a/codegen/Crm/Lists/Model/PublicListFolder.php +++ b/codegen/Crm/Lists/Model/PublicListFolder.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('parent_folder_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicMigrationMapping.php b/codegen/Crm/Lists/Model/PublicMigrationMapping.php index bee67bca6..3fd3b4933 100644 --- a/codegen/Crm/Lists/Model/PublicMigrationMapping.php +++ b/codegen/Crm/Lists/Model/PublicMigrationMapping.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_id', $data ?? [], null); $this->setIfExists('legacy_list_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicMonthReference.php b/codegen/Crm/Lists/Model/PublicMonthReference.php index 5775a02f4..107fdfe70 100644 --- a/codegen/Crm/Lists/Model/PublicMonthReference.php +++ b/codegen/Crm/Lists/Model/PublicMonthReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('millisecond', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicMultiStringPropertyOperation.php b/codegen/Crm/Lists/Model/PublicMultiStringPropertyOperation.php index c7d51e185..658908a5f 100644 --- a/codegen/Crm/Lists/Model/PublicMultiStringPropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicMultiStringPropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('values', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicNotAllFilterBranch.php b/codegen/Crm/Lists/Model/PublicNotAllFilterBranch.php index 24c3c644d..dd5d262c9 100644 --- a/codegen/Crm/Lists/Model/PublicNotAllFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicNotAllFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'NOT_ALL'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicNotAnyFilterBranch.php b/codegen/Crm/Lists/Model/PublicNotAnyFilterBranch.php index 44a0b2e02..0886271ae 100644 --- a/codegen/Crm/Lists/Model/PublicNotAnyFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicNotAnyFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'NOT_ANY'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicNowReference.php b/codegen/Crm/Lists/Model/PublicNowReference.php index b4a5101c0..4f59992c3 100644 --- a/codegen/Crm/Lists/Model/PublicNowReference.php +++ b/codegen/Crm/Lists/Model/PublicNowReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('millisecond', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicNumAssociationsFilter.php b/codegen/Crm/Lists/Model/PublicNumAssociationsFilter.php index 5387ed90c..2f7e7d3bb 100644 --- a/codegen/Crm/Lists/Model/PublicNumAssociationsFilter.php +++ b/codegen/Crm/Lists/Model/PublicNumAssociationsFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('coalescing_refine_by', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicNumOccurrencesRefineBy.php b/codegen/Crm/Lists/Model/PublicNumOccurrencesRefineBy.php index 43db15c39..1928f1c82 100644 --- a/codegen/Crm/Lists/Model/PublicNumOccurrencesRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicNumOccurrencesRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('max_occurrences', $data ?? [], null); $this->setIfExists('type', $data ?? [], 'NUM_OCCURRENCES'); diff --git a/codegen/Crm/Lists/Model/PublicNumberPropertyOperation.php b/codegen/Crm/Lists/Model/PublicNumberPropertyOperation.php index b4d1a6c94..0bae95f45 100644 --- a/codegen/Crm/Lists/Model/PublicNumberPropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicNumberPropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('operation_type', $data ?? [], 'NUMBER'); diff --git a/codegen/Crm/Lists/Model/PublicObjectList.php b/codegen/Crm/Lists/Model/PublicObjectList.php index a03f09762..0a568163c 100644 --- a/codegen/Crm/Lists/Model/PublicObjectList.php +++ b/codegen/Crm/Lists/Model/PublicObjectList.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -317,10 +317,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('processing_type', $data ?? [], null); $this->setIfExists('object_type_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicObjectListSearchResult.php b/codegen/Crm/Lists/Model/PublicObjectListSearchResult.php index 09c8dc6bd..b871b7d31 100644 --- a/codegen/Crm/Lists/Model/PublicObjectListSearchResult.php +++ b/codegen/Crm/Lists/Model/PublicObjectListSearchResult.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -311,10 +311,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('processing_type', $data ?? [], null); $this->setIfExists('object_type_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicOrFilterBranch.php b/codegen/Crm/Lists/Model/PublicOrFilterBranch.php index 19c265150..ba2c3237f 100644 --- a/codegen/Crm/Lists/Model/PublicOrFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicOrFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'OR'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicPageViewAnalyticsFilter.php b/codegen/Crm/Lists/Model/PublicPageViewAnalyticsFilter.php index b6a85c638..06a80b4b2 100644 --- a/codegen/Crm/Lists/Model/PublicPageViewAnalyticsFilter.php +++ b/codegen/Crm/Lists/Model/PublicPageViewAnalyticsFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('coalescing_refine_by', $data ?? [], null); $this->setIfExists('enable_tracking', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicPrivacyAnalyticsFilter.php b/codegen/Crm/Lists/Model/PublicPrivacyAnalyticsFilter.php index e83a59768..3c2969b10 100644 --- a/codegen/Crm/Lists/Model/PublicPrivacyAnalyticsFilter.php +++ b/codegen/Crm/Lists/Model/PublicPrivacyAnalyticsFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('privacy_name', $data ?? [], null); $this->setIfExists('filter_type', $data ?? [], 'PRIVACY'); diff --git a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranch.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranch.php index 85511e747..9bc160d9f 100644 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'PROPERTY_ASSOCIATION'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php index ada0f863c..1d003be17 100644 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php +++ b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFilterBranchesInner.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -312,10 +312,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'ASSOCIATION'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php index 7db09aa7b..d6000efed 100644 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php +++ b/codegen/Crm/Lists/Model/PublicPropertyAssociationFilterBranchFiltersInner.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -516,10 +516,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('property', $data ?? [], null); $this->setIfExists('filter_type', $data ?? [], 'CONSTANT'); diff --git a/codegen/Crm/Lists/Model/PublicPropertyAssociationInListFilter.php b/codegen/Crm/Lists/Model/PublicPropertyAssociationInListFilter.php index b1f8054ee..3a90e73dd 100644 --- a/codegen/Crm/Lists/Model/PublicPropertyAssociationInListFilter.php +++ b/codegen/Crm/Lists/Model/PublicPropertyAssociationInListFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_id', $data ?? [], null); $this->setIfExists('coalescing_refine_by', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicPropertyFilter.php b/codegen/Crm/Lists/Model/PublicPropertyFilter.php index 7a112de04..b6b8c981a 100644 --- a/codegen/Crm/Lists/Model/PublicPropertyFilter.php +++ b/codegen/Crm/Lists/Model/PublicPropertyFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('property', $data ?? [], null); $this->setIfExists('filter_type', $data ?? [], 'PROPERTY'); diff --git a/codegen/Crm/Lists/Model/PublicPropertyReferencedTime.php b/codegen/Crm/Lists/Model/PublicPropertyReferencedTime.php index f363c5ba8..a975d9b02 100644 --- a/codegen/Crm/Lists/Model/PublicPropertyReferencedTime.php +++ b/codegen/Crm/Lists/Model/PublicPropertyReferencedTime.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getTimeTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('timezone_source', $data ?? [], null); $this->setIfExists('property', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicQuarterReference.php b/codegen/Crm/Lists/Model/PublicQuarterReference.php index a0141d01e..af9cdd169 100644 --- a/codegen/Crm/Lists/Model/PublicQuarterReference.php +++ b/codegen/Crm/Lists/Model/PublicQuarterReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('month', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRangedDatePropertyOperation.php b/codegen/Crm/Lists/Model/PublicRangedDatePropertyOperation.php index f0a4c695c..ce49e0241 100644 --- a/codegen/Crm/Lists/Model/PublicRangedDatePropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicRangedDatePropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('upper_bound', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRangedNumberPropertyOperation.php b/codegen/Crm/Lists/Model/PublicRangedNumberPropertyOperation.php index 3c298291f..f307321b4 100644 --- a/codegen/Crm/Lists/Model/PublicRangedNumberPropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicRangedNumberPropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('upper_bound', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRangedTimeOperation.php b/codegen/Crm/Lists/Model/PublicRangedTimeOperation.php index b889de338..f5acda23c 100644 --- a/codegen/Crm/Lists/Model/PublicRangedTimeOperation.php +++ b/codegen/Crm/Lists/Model/PublicRangedTimeOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('upper_bound_endpoint_behavior', $data ?? [], null); $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRelativeComparativeTimestampRefineBy.php b/codegen/Crm/Lists/Model/PublicRelativeComparativeTimestampRefineBy.php index ce14dc791..9e1fee3ff 100644 --- a/codegen/Crm/Lists/Model/PublicRelativeComparativeTimestampRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicRelativeComparativeTimestampRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('comparison', $data ?? [], null); $this->setIfExists('time_offset', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRelativeRangedTimestampRefineBy.php b/codegen/Crm/Lists/Model/PublicRelativeRangedTimestampRefineBy.php index d026a21d4..6fc928321 100644 --- a/codegen/Crm/Lists/Model/PublicRelativeRangedTimestampRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicRelativeRangedTimestampRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('upper_bound_offset', $data ?? [], null); $this->setIfExists('range_type', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRestrictedFilterBranch.php b/codegen/Crm/Lists/Model/PublicRestrictedFilterBranch.php index 7e9baa129..222cb1f2b 100644 --- a/codegen/Crm/Lists/Model/PublicRestrictedFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicRestrictedFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getFilterBranchTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'RESTRICTED'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRollingDateRangePropertyOperation.php b/codegen/Crm/Lists/Model/PublicRollingDateRangePropertyOperation.php index cae80245f..1dabd3f3c 100644 --- a/codegen/Crm/Lists/Model/PublicRollingDateRangePropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicRollingDateRangePropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('requires_time_zone_conversion', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicRollingPropertyUpdatedOperation.php b/codegen/Crm/Lists/Model/PublicRollingPropertyUpdatedOperation.php index 02d948563..b700241a2 100644 --- a/codegen/Crm/Lists/Model/PublicRollingPropertyUpdatedOperation.php +++ b/codegen/Crm/Lists/Model/PublicRollingPropertyUpdatedOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('operation_type', $data ?? [], 'ROLLING_PROPERTY_UPDATED'); diff --git a/codegen/Crm/Lists/Model/PublicSetOccurrencesRefineBy.php b/codegen/Crm/Lists/Model/PublicSetOccurrencesRefineBy.php index 3ba172ef2..569561b87 100644 --- a/codegen/Crm/Lists/Model/PublicSetOccurrencesRefineBy.php +++ b/codegen/Crm/Lists/Model/PublicSetOccurrencesRefineBy.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type', $data ?? [], 'SET_OCCURRENCES'); $this->setIfExists('set_type', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicStringPropertyOperation.php b/codegen/Crm/Lists/Model/PublicStringPropertyOperation.php index ec52fb2da..816b8a589 100644 --- a/codegen/Crm/Lists/Model/PublicStringPropertyOperation.php +++ b/codegen/Crm/Lists/Model/PublicStringPropertyOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('operation_type', $data ?? [], 'STRING'); diff --git a/codegen/Crm/Lists/Model/PublicSurveyMonkeyFilter.php b/codegen/Crm/Lists/Model/PublicSurveyMonkeyFilter.php index c094cd0ed..5f876943e 100644 --- a/codegen/Crm/Lists/Model/PublicSurveyMonkeyFilter.php +++ b/codegen/Crm/Lists/Model/PublicSurveyMonkeyFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('survey_id', $data ?? [], null); $this->setIfExists('filter_type', $data ?? [], 'SURVEY_MONKEY'); diff --git a/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilter.php b/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilter.php index ba0c086d2..cf6a08ed4 100644 --- a/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilter.php +++ b/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('value_comparison', $data ?? [], null); $this->setIfExists('survey_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilterValueComparison.php b/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilterValueComparison.php index 84cb81da1..8341d68e4 100644 --- a/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilterValueComparison.php +++ b/codegen/Crm/Lists/Model/PublicSurveyMonkeyValueFilterValueComparison.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -430,10 +430,10 @@ public function getFiscalYearStartAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); $this->setIfExists('operation_type', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicTimeOffset.php b/codegen/Crm/Lists/Model/PublicTimeOffset.php index b3ba2a2da..656d1c143 100644 --- a/codegen/Crm/Lists/Model/PublicTimeOffset.php +++ b/codegen/Crm/Lists/Model/PublicTimeOffset.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('amount', $data ?? [], null); $this->setIfExists('offset_direction', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicTimePointOperation.php b/codegen/Crm/Lists/Model/PublicTimePointOperation.php index 219f12341..a21b877a2 100644 --- a/codegen/Crm/Lists/Model/PublicTimePointOperation.php +++ b/codegen/Crm/Lists/Model/PublicTimePointOperation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getOperationTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('endpoint_behavior', $data ?? [], null); $this->setIfExists('include_objects_with_no_value_set', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicTimePointOperationTimePoint.php b/codegen/Crm/Lists/Model/PublicTimePointOperationTimePoint.php index 7dd3fdc43..be89c62af 100644 --- a/codegen/Crm/Lists/Model/PublicTimePointOperationTimePoint.php +++ b/codegen/Crm/Lists/Model/PublicTimePointOperationTimePoint.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -330,10 +330,10 @@ public function getTimeTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('month', $data ?? [], null); $this->setIfExists('hour', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicTodayReference.php b/codegen/Crm/Lists/Model/PublicTodayReference.php index f7a62f365..2e14390c9 100644 --- a/codegen/Crm/Lists/Model/PublicTodayReference.php +++ b/codegen/Crm/Lists/Model/PublicTodayReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('millisecond', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicUnifiedEventsFilter.php b/codegen/Crm/Lists/Model/PublicUnifiedEventsFilter.php index 36cc5b3ee..b4b2c1946 100644 --- a/codegen/Crm/Lists/Model/PublicUnifiedEventsFilter.php +++ b/codegen/Crm/Lists/Model/PublicUnifiedEventsFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('coalescing_refine_by', $data ?? [], null); $this->setIfExists('event_type_id', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicUnifiedEventsFilterBranch.php b/codegen/Crm/Lists/Model/PublicUnifiedEventsFilterBranch.php index 1eb45e4f2..77f3e2762 100644 --- a/codegen/Crm/Lists/Model/PublicUnifiedEventsFilterBranch.php +++ b/codegen/Crm/Lists/Model/PublicUnifiedEventsFilterBranch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -265,8 +265,8 @@ public function getModelName() } public const FILTER_BRANCH_TYPE_UNIFIED_EVENTS = 'UNIFIED_EVENTS'; - public const OPERATOR_COMPLETED = 'HAS_COMPLETED'; - public const OPERATOR_NOT_COMPLETED = 'HAS_NOT_COMPLETED'; + public const OPERATOR_HAS_COMPLETED = 'HAS_COMPLETED'; + public const OPERATOR_HAS_NOT_COMPLETED = 'HAS_NOT_COMPLETED'; /** * Gets allowable values of the enum @@ -288,8 +288,8 @@ public function getFilterBranchTypeAllowableValues() public function getOperatorAllowableValues() { return [ - self::OPERATOR_COMPLETED, - self::OPERATOR_NOT_COMPLETED, + self::OPERATOR_HAS_COMPLETED, + self::OPERATOR_HAS_NOT_COMPLETED, ]; } @@ -303,10 +303,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filter_branch_type', $data ?? [], 'UNIFIED_EVENTS'); $this->setIfExists('filter_branches', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicWebinarFilter.php b/codegen/Crm/Lists/Model/PublicWebinarFilter.php index 11af29d97..49c47765c 100644 --- a/codegen/Crm/Lists/Model/PublicWebinarFilter.php +++ b/codegen/Crm/Lists/Model/PublicWebinarFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getFilterTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('webinar_id', $data ?? [], null); $this->setIfExists('filter_type', $data ?? [], 'WEBINAR'); diff --git a/codegen/Crm/Lists/Model/PublicWeekReference.php b/codegen/Crm/Lists/Model/PublicWeekReference.php index d712ae1d2..6b61e6817 100644 --- a/codegen/Crm/Lists/Model/PublicWeekReference.php +++ b/codegen/Crm/Lists/Model/PublicWeekReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -307,10 +307,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('day_of_week', $data ?? [], null); $this->setIfExists('hour', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/PublicYearReference.php b/codegen/Crm/Lists/Model/PublicYearReference.php index 4c16a007b..1c1358f8b 100644 --- a/codegen/Crm/Lists/Model/PublicYearReference.php +++ b/codegen/Crm/Lists/Model/PublicYearReference.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getReferenceTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hour', $data ?? [], null); $this->setIfExists('month', $data ?? [], null); diff --git a/codegen/Crm/Lists/Model/RecordListMembership.php b/codegen/Crm/Lists/Model/RecordListMembership.php index 478b32aa1..ba2a296fe 100644 --- a/codegen/Crm/Lists/Model/RecordListMembership.php +++ b/codegen/Crm/Lists/Model/RecordListMembership.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('list_id', $data ?? [], null); $this->setIfExists('list_version', $data ?? [], null); diff --git a/codegen/Crm/Lists/ObjectSerializer.php b/codegen/Crm/Lists/ObjectSerializer.php index 65583d42f..f3cc8e5f4 100644 --- a/codegen/Crm/Lists/ObjectSerializer.php +++ b/codegen/Crm/Lists/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Api/BasicApi.php b/codegen/Crm/Objects/Api/BasicApi.php index 89ad69b80..6cf8e575f 100644 --- a/codegen/Crm/Objects/Api/BasicApi.php +++ b/codegen/Crm/Objects/Api/BasicApi.php @@ -10,7 +10,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Api/BatchApi.php b/codegen/Crm/Objects/Api/BatchApi.php index 1458d5a7c..d6d811bae 100644 --- a/codegen/Crm/Objects/Api/BatchApi.php +++ b/codegen/Crm/Objects/Api/BatchApi.php @@ -10,7 +10,7 @@ */ /** - * Objects + * CRM Objects * * 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. * @@ -400,16 +400,16 @@ public function archiveRequest($object_type, $batch_input_simple_public_object_i * Create a batch of objects * * @param string $object_type object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error */ - public function create($object_type, $batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($object_type, $batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($object_type, $batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -419,16 +419,16 @@ public function create($object_type, $batch_input_simple_public_object_input_for * Create a batch of objects * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($object_type, $batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($object_type, $batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($object_type, $batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -614,15 +614,15 @@ public function createWithHttpInfo($object_type, $batch_input_simple_public_obje * Create a batch of objects * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($object_type, $batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($object_type, $batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -636,16 +636,16 @@ function ($response) { * Create a batch of objects * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($object_type, $batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($object_type, $batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -687,13 +687,13 @@ function ($exception) { * Create request for operation 'create' * * @param string $object_type (required) - * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($object_type, $batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($object_type, $batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { // verify the required parameter 'object_type' is set @@ -703,10 +703,10 @@ public function createRequest($object_type, $batch_input_simple_public_object_in ); } - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -737,12 +737,12 @@ public function createRequest($object_type, $batch_input_simple_public_object_in ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/codegen/Crm/Objects/Api/SearchApi.php b/codegen/Crm/Objects/Api/SearchApi.php index 35bd7370c..b7ee9eedb 100644 --- a/codegen/Crm/Objects/Api/SearchApi.php +++ b/codegen/Crm/Objects/Api/SearchApi.php @@ -10,7 +10,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/ApiException.php b/codegen/Crm/Objects/ApiException.php index 6df651ac7..5ff10a060 100644 --- a/codegen/Crm/Objects/ApiException.php +++ b/codegen/Crm/Objects/ApiException.php @@ -10,7 +10,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Calls/Api/BasicApi.php b/codegen/Crm/Objects/Calls/Api/BasicApi.php index 4558068c5..2fddc3bd4 100644 --- a/codegen/Crm/Objects/Calls/Api/BasicApi.php +++ b/codegen/Crm/Objects/Calls/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -139,7 +139,7 @@ public function getConfig() * * Archive * - * @param string $call_id call_id (required) + * @param string $call_id The ID of the call. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -156,7 +156,7 @@ public function archive($call_id, string $contentType = self::contentTypes['arch * * Archive * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($call_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -224,7 +212,7 @@ public function archiveWithHttpInfo($call_id, string $contentType = self::conten * * Archive * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -245,7 +233,7 @@ function ($response) { * * Archive * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -282,7 +270,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -725,12 +714,12 @@ public function createRequest($simple_public_object_input_for_create, string $co * * Read * - * @param string $call_id call_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $call_id The ID of the call. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -748,12 +737,12 @@ public function getById($call_id, $properties = null, $properties_with_history = * * Read * - * @param string $call_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $call_id The ID of the call. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($call_id, $properties = null, $properties_wi $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($call_id, $properties = null, $properties_wi ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -912,12 +902,12 @@ public function getByIdWithHttpInfo($call_id, $properties = null, $properties_wi * * Read * - * @param string $call_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $call_id The ID of the call. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -938,12 +928,12 @@ function ($response) { * * Read * - * @param string $call_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $call_id The ID of the call. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,12 +983,12 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $call_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $call_id The ID of the call. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($call_id, $properties = null, $properties_with_hi * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1562,9 +1553,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * Update * - * @param string $call_id call_id (required) + * @param string $call_id The ID of the call. (required) * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -1582,9 +1573,9 @@ public function update($call_id, $simple_public_object_input, $id_property = nul * * Update * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($call_id, $simple_public_object_input, $id_pr $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($call_id, $simple_public_object_input, $id_pr ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1743,9 +1735,9 @@ public function updateWithHttpInfo($call_id, $simple_public_object_input, $id_pr * * Update * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1766,9 +1758,9 @@ function ($response) { * * Update * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1818,9 +1810,9 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $call_id (required) + * @param string $call_id The ID of the call. (required) * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Calls/Api/BatchApi.php b/codegen/Crm/Objects/Calls/Api/BatchApi.php index faf5d7847..753640c36 100644 --- a/codegen/Crm/Objects/Calls/Api/BatchApi.php +++ b/codegen/Crm/Objects/Calls/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of calls * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Calls\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of calls * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Calls\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of calls * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of calls * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of calls by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of calls by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Calls\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of calls by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of calls by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Calls\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Calls/Api/SearchApi.php b/codegen/Crm/Objects/Calls/Api/SearchApi.php index 09202fd96..ebecf96fd 100644 --- a/codegen/Crm/Objects/Calls/Api/SearchApi.php +++ b/codegen/Crm/Objects/Calls/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for calls + * * @param \HubSpot\Client\Crm\Objects\Calls\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for calls + * * @param \HubSpot\Client\Crm\Objects\Calls\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Calls\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for calls + * * @param \HubSpot\Client\Crm\Objects\Calls\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for calls + * * @param \HubSpot\Client\Crm\Objects\Calls\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 * diff --git a/codegen/Crm/Objects/Calls/ApiException.php b/codegen/Crm/Objects/Calls/ApiException.php index 6995c133d..826fd7b8b 100644 --- a/codegen/Crm/Objects/Calls/ApiException.php +++ b/codegen/Crm/Objects/Calls/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Calls/Configuration.php b/codegen/Crm/Objects/Calls/Configuration.php index ea754e206..ac491f688 100644 --- a/codegen/Crm/Objects/Calls/Configuration.php +++ b/codegen/Crm/Objects/Calls/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Calls/HeaderSelector.php b/codegen/Crm/Objects/Calls/HeaderSelector.php index 613a095ed..84c2d23db 100644 --- a/codegen/Crm/Objects/Calls/HeaderSelector.php +++ b/codegen/Crm/Objects/Calls/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Calls/Model/AssociatedId.php b/codegen/Crm/Objects/Calls/Model/AssociatedId.php index c18b7a0b8..36d62deeb 100644 --- a/codegen/Crm/Objects/Calls/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Calls/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/AssociationSpec.php b/codegen/Crm/Objects/Calls/Model/AssociationSpec.php index 1d2752396..c2997d061 100644 --- a/codegen/Crm/Objects/Calls/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Calls/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInput.php index b52088f4a..3786cb450 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 9bc5f9d26..9d5b1fd92 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Calls\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index f549c9ed1..45dd5677b 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectId.php index a80d74a8a..b9d9beb22 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Calls/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php index 3a70c2213..9eb1b9df3 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Calls/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php index b80d0d6fc..36d989f5d 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObjectWithErrors.php index f83017c16..de3f4b6b0 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php index 54589082c..f8955a24f 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 3d30eae1f..6e63a532e 100644 --- a/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Calls/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Calls/Model/CollectionResponseAssociatedId.php index 6267b2c78..e2632f95e 100644 --- a/codegen/Crm/Objects/Calls/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Calls/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 4e6659c82..fb981b0f6 100644 --- a/codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Calls/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Calls/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index bbda3cb2c..bb6d792b8 100644 --- a/codegen/Crm/Objects/Calls/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Calls/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/Error.php b/codegen/Crm/Objects/Calls/Model/Error.php index cf07fa0b1..bd937087e 100644 --- a/codegen/Crm/Objects/Calls/Model/Error.php +++ b/codegen/Crm/Objects/Calls/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/ErrorDetail.php b/codegen/Crm/Objects/Calls/Model/ErrorDetail.php index f05439803..04aa185ed 100644 --- a/codegen/Crm/Objects/Calls/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Calls/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/Filter.php b/codegen/Crm/Objects/Calls/Model/Filter.php index 47d152b4d..3fef2cf02 100644 --- a/codegen/Crm/Objects/Calls/Model/Filter.php +++ b/codegen/Crm/Objects/Calls/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/FilterGroup.php b/codegen/Crm/Objects/Calls/Model/FilterGroup.php index 612e9edc7..cd9cae9d0 100644 --- a/codegen/Crm/Objects/Calls/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Calls/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Calls/Model/ForwardPaging.php b/codegen/Crm/Objects/Calls/Model/ForwardPaging.php index 60c39b1b6..c869aa8d7 100644 --- a/codegen/Crm/Objects/Calls/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Calls/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Calls/Model/ModelInterface.php b/codegen/Crm/Objects/Calls/Model/ModelInterface.php index 83f3d8d61..7e6eecef4 100644 --- a/codegen/Crm/Objects/Calls/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Calls/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Calls/Model/NextPage.php b/codegen/Crm/Objects/Calls/Model/NextPage.php index e8ca60bfc..94f3a6663 100644 --- a/codegen/Crm/Objects/Calls/Model/NextPage.php +++ b/codegen/Crm/Objects/Calls/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/Paging.php b/codegen/Crm/Objects/Calls/Model/Paging.php index 15a2452f7..67cc4ab7b 100644 --- a/codegen/Crm/Objects/Calls/Model/Paging.php +++ b/codegen/Crm/Objects/Calls/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/PreviousPage.php b/codegen/Crm/Objects/Calls/Model/PreviousPage.php index aac4a025f..ba12ddc80 100644 --- a/codegen/Crm/Objects/Calls/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Calls/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Calls/Model/PublicAssociationsForObject.php index 80906a37b..768b86468 100644 --- a/codegen/Crm/Objects/Calls/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Calls/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/PublicObjectId.php b/codegen/Crm/Objects/Calls/Model/PublicObjectId.php index 163834b65..5142ec282 100644 --- a/codegen/Crm/Objects/Calls/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Calls/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Calls/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Calls/Model/PublicObjectSearchRequest.php index 30dfdf872..6dde27439 100644 --- a/codegen/Crm/Objects/Calls/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Calls/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php index 3d29a4d7e..36e817829 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInput.php index 388a2a1c7..ff63afb54 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..259608e7e --- /dev/null +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputUpsert.php index b7dc5974c..1efd0217e 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectId.php index ac5600718..86b717478 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php index 90e4daabb..884c05492 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php index 6b4829df0..864416d66 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Calls\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php index 986a54b18..7c0bf7fc1 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Calls/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Calls/Model/SimplePublicUpsertObject.php index 88138e575..4560e4206 100644 --- a/codegen/Crm/Objects/Calls/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Calls/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Calls/Model/StandardError.php b/codegen/Crm/Objects/Calls/Model/StandardError.php index 11db79de9..9436b3196 100644 --- a/codegen/Crm/Objects/Calls/Model/StandardError.php +++ b/codegen/Crm/Objects/Calls/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php index fd92b5d80..23d2de40e 100644 --- a/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Calls/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Calls/ObjectSerializer.php b/codegen/Crm/Objects/Calls/ObjectSerializer.php index 8268c851c..17a8f1042 100644 --- a/codegen/Crm/Objects/Calls/ObjectSerializer.php +++ b/codegen/Crm/Objects/Calls/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Communications/Api/BasicApi.php b/codegen/Crm/Objects/Communications/Api/BasicApi.php index 1301d9311..b21034366 100644 --- a/codegen/Crm/Objects/Communications/Api/BasicApi.php +++ b/codegen/Crm/Objects/Communications/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -139,7 +139,7 @@ public function getConfig() * * Archive * - * @param string $communication_id communication_id (required) + * @param string $communication_id The ID of the message to update. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -156,7 +156,7 @@ public function archive($communication_id, string $contentType = self::contentTy * * Archive * - * @param string $communication_id (required) + * @param string $communication_id The ID of the message to update. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($communication_id, string $contentType = sel $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -224,7 +212,7 @@ public function archiveWithHttpInfo($communication_id, string $contentType = sel * * Archive * - * @param string $communication_id (required) + * @param string $communication_id The ID of the message to update. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -245,7 +233,7 @@ function ($response) { * * Archive * - * @param string $communication_id (required) + * @param string $communication_id The ID of the message to update. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -282,7 +270,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $communication_id (required) + * @param string $communication_id The ID of the message to update. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -725,12 +714,12 @@ public function createRequest($simple_public_object_input_for_create, string $co * * Read * - * @param string $communication_id communication_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $communication_id The ID of the message to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -748,12 +737,12 @@ public function getById($communication_id, $properties = null, $properties_with_ * * Read * - * @param string $communication_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $communication_id The ID of the message to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($communication_id, $properties = null, $prop $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($communication_id, $properties = null, $prop ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -912,12 +902,12 @@ public function getByIdWithHttpInfo($communication_id, $properties = null, $prop * * Read * - * @param string $communication_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $communication_id The ID of the message to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -938,12 +928,12 @@ function ($response) { * * Read * - * @param string $communication_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $communication_id The ID of the message to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,12 +983,12 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $communication_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $communication_id The ID of the message to retrieve. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($communication_id, $properties = null, $propertie * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1562,9 +1553,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * Update * - * @param string $communication_id communication_id (required) + * @param string $communication_id The ID of the communication to update. (required) * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -1582,9 +1573,9 @@ public function update($communication_id, $simple_public_object_input, $id_prope * * Update * - * @param string $communication_id (required) + * @param string $communication_id The ID of the communication to update. (required) * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($communication_id, $simple_public_object_inpu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($communication_id, $simple_public_object_inpu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1743,9 +1735,9 @@ public function updateWithHttpInfo($communication_id, $simple_public_object_inpu * * Update * - * @param string $communication_id (required) + * @param string $communication_id The ID of the communication to update. (required) * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1766,9 +1758,9 @@ function ($response) { * * Update * - * @param string $communication_id (required) + * @param string $communication_id The ID of the communication to update. (required) * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1818,9 +1810,9 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $communication_id (required) + * @param string $communication_id The ID of the communication to update. (required) * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Communications/Api/BatchApi.php b/codegen/Crm/Objects/Communications/Api/BatchApi.php index c694f2ad8..c7ae3e8e7 100644 --- a/codegen/Crm/Objects/Communications/Api/BatchApi.php +++ b/codegen/Crm/Objects/Communications/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of communications * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Communications\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of communications * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Communications\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of communications * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of communications * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of communications by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of communications by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Communications\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of communications by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of communications by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Communications\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Communications/Api/SearchApi.php b/codegen/Crm/Objects/Communications/Api/SearchApi.php index 9ff8af850..5c4a2fe3c 100644 --- a/codegen/Crm/Objects/Communications/Api/SearchApi.php +++ b/codegen/Crm/Objects/Communications/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for messages + * * @param \HubSpot\Client\Crm\Objects\Communications\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for messages + * * @param \HubSpot\Client\Crm\Objects\Communications\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Communications\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for messages + * * @param \HubSpot\Client\Crm\Objects\Communications\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for messages + * * @param \HubSpot\Client\Crm\Objects\Communications\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 * diff --git a/codegen/Crm/Objects/Communications/ApiException.php b/codegen/Crm/Objects/Communications/ApiException.php index 8f842bc07..29f9154e7 100644 --- a/codegen/Crm/Objects/Communications/ApiException.php +++ b/codegen/Crm/Objects/Communications/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Communications/Configuration.php b/codegen/Crm/Objects/Communications/Configuration.php index 2cee15c76..0c87fcbaf 100644 --- a/codegen/Crm/Objects/Communications/Configuration.php +++ b/codegen/Crm/Objects/Communications/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Communications/HeaderSelector.php b/codegen/Crm/Objects/Communications/HeaderSelector.php index b3bc9c55c..0c3e95ab1 100644 --- a/codegen/Crm/Objects/Communications/HeaderSelector.php +++ b/codegen/Crm/Objects/Communications/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Communications/Model/AssociatedId.php b/codegen/Crm/Objects/Communications/Model/AssociatedId.php index c28528e2b..d21d2904f 100644 --- a/codegen/Crm/Objects/Communications/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Communications/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/AssociationSpec.php b/codegen/Crm/Objects/Communications/Model/AssociationSpec.php index 034e71053..4ca62cda1 100644 --- a/codegen/Crm/Objects/Communications/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Communications/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInput.php index eef2cd567..e1f3795aa 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 031c67f4c..bcb18d9fd 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Communications\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 8dae8d09d..8c440e887 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectId.php index eddd9ef5f..b2c840d9d 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Communications/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php index 0931e4795..50f8596b2 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Communications/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php index 96b7ccb4b..6832b7e86 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObjectWithErrors.php index f97a32863..7aa83afb7 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php index c4c5b9bff..1f0e15691 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index c7e2abaa8..5c4c7f284 100644 --- a/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Communications/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Communications/Model/CollectionResponseAssociatedId.php index ca70841f6..622e67199 100644 --- a/codegen/Crm/Objects/Communications/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Communications/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Communications/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 4904e6718..335d0c38a 100644 --- a/codegen/Crm/Objects/Communications/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Communications/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 3ea8b3c6f..f0f7f21e2 100644 --- a/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Communications/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/Error.php b/codegen/Crm/Objects/Communications/Model/Error.php index 0fcd77498..73ed75db3 100644 --- a/codegen/Crm/Objects/Communications/Model/Error.php +++ b/codegen/Crm/Objects/Communications/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/ErrorDetail.php b/codegen/Crm/Objects/Communications/Model/ErrorDetail.php index 0786789f5..c97ecb1b8 100644 --- a/codegen/Crm/Objects/Communications/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Communications/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/Filter.php b/codegen/Crm/Objects/Communications/Model/Filter.php index c427120da..41a594b86 100644 --- a/codegen/Crm/Objects/Communications/Model/Filter.php +++ b/codegen/Crm/Objects/Communications/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/FilterGroup.php b/codegen/Crm/Objects/Communications/Model/FilterGroup.php index aefdceca6..616ee8585 100644 --- a/codegen/Crm/Objects/Communications/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Communications/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Communications/Model/ForwardPaging.php b/codegen/Crm/Objects/Communications/Model/ForwardPaging.php index c462128ef..ce56282d1 100644 --- a/codegen/Crm/Objects/Communications/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Communications/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Communications/Model/ModelInterface.php b/codegen/Crm/Objects/Communications/Model/ModelInterface.php index d17cedc9e..49a4fefa3 100644 --- a/codegen/Crm/Objects/Communications/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Communications/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Communications/Model/NextPage.php b/codegen/Crm/Objects/Communications/Model/NextPage.php index f5ca20a1b..37d3f3558 100644 --- a/codegen/Crm/Objects/Communications/Model/NextPage.php +++ b/codegen/Crm/Objects/Communications/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/Paging.php b/codegen/Crm/Objects/Communications/Model/Paging.php index 4b7012601..484f63a0d 100644 --- a/codegen/Crm/Objects/Communications/Model/Paging.php +++ b/codegen/Crm/Objects/Communications/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/PreviousPage.php b/codegen/Crm/Objects/Communications/Model/PreviousPage.php index 1cb571e33..4d683bc6a 100644 --- a/codegen/Crm/Objects/Communications/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Communications/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Communications/Model/PublicAssociationsForObject.php index 238a7d821..b1f238a6e 100644 --- a/codegen/Crm/Objects/Communications/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Communications/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/PublicObjectId.php b/codegen/Crm/Objects/Communications/Model/PublicObjectId.php index ad42f3c72..0cef465a0 100644 --- a/codegen/Crm/Objects/Communications/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Communications/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Communications/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Communications/Model/PublicObjectSearchRequest.php index 6625f64ee..273773604 100644 --- a/codegen/Crm/Objects/Communications/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Communications/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php index c314bd8ae..064af2151 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInput.php index 2904fbbe8..59367a2a2 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..d37e6f75e --- /dev/null +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputUpsert.php index 39eef18bc..9ab75dc94 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectId.php index 4bf5d3535..821c93bbf 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php index 203fd3e96..532bd9898 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php index 5e42c7a22..af99350ec 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Communications\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php index 5458ff22a..72ae8088b 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Communications/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Communications/Model/SimplePublicUpsertObject.php index 1084e0b1c..872944761 100644 --- a/codegen/Crm/Objects/Communications/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Communications/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Communications/Model/StandardError.php b/codegen/Crm/Objects/Communications/Model/StandardError.php index f3eae5f59..9877c0ee0 100644 --- a/codegen/Crm/Objects/Communications/Model/StandardError.php +++ b/codegen/Crm/Objects/Communications/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php index 1e8736443..1989ab4a5 100644 --- a/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Communications/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Communications/ObjectSerializer.php b/codegen/Crm/Objects/Communications/ObjectSerializer.php index 72891f5d3..d920477d7 100644 --- a/codegen/Crm/Objects/Communications/ObjectSerializer.php +++ b/codegen/Crm/Objects/Communications/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Configuration.php b/codegen/Crm/Objects/Configuration.php index c8183effe..3ab9f3083 100644 --- a/codegen/Crm/Objects/Configuration.php +++ b/codegen/Crm/Objects/Configuration.php @@ -10,7 +10,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Emails/Api/BasicApi.php b/codegen/Crm/Objects/Emails/Api/BasicApi.php index 88007ede2..01836d65d 100644 --- a/codegen/Crm/Objects/Emails/Api/BasicApi.php +++ b/codegen/Crm/Objects/Emails/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($email_id, string $contentType = self::conte $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $email_id email_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($email_id, $properties = null, $properties_with_history * Read * * @param string $email_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($email_id, $properties = null, $properties_w $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($email_id, $properties = null, $properties_w ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($email_id, $properties = null, $properties_w * Read * * @param string $email_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $email_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $email_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($email_id, $properties = null, $properties_with_h * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $email_id email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($email_id, $simple_public_object_input, $id_property = nu * * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_p $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_p ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_p * * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Emails/Api/BatchApi.php b/codegen/Crm/Objects/Emails/Api/BatchApi.php index 604e38fa6..6704d23c5 100644 --- a/codegen/Crm/Objects/Emails/Api/BatchApi.php +++ b/codegen/Crm/Objects/Emails/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of emails * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of emails * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of emails * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of emails * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of emails by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of emails by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of emails by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of emails by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Emails/Api/SearchApi.php b/codegen/Crm/Objects/Emails/Api/SearchApi.php index 4a3e33d9d..6a02a0444 100644 --- a/codegen/Crm/Objects/Emails/Api/SearchApi.php +++ b/codegen/Crm/Objects/Emails/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Emails/ApiException.php b/codegen/Crm/Objects/Emails/ApiException.php index c9a93fa20..706732f3f 100644 --- a/codegen/Crm/Objects/Emails/ApiException.php +++ b/codegen/Crm/Objects/Emails/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Emails/Configuration.php b/codegen/Crm/Objects/Emails/Configuration.php index 7d1e4d86d..ad7bc2a54 100644 --- a/codegen/Crm/Objects/Emails/Configuration.php +++ b/codegen/Crm/Objects/Emails/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Emails/HeaderSelector.php b/codegen/Crm/Objects/Emails/HeaderSelector.php index 403718d8c..bcedba9f6 100644 --- a/codegen/Crm/Objects/Emails/HeaderSelector.php +++ b/codegen/Crm/Objects/Emails/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Emails/Model/AssociatedId.php b/codegen/Crm/Objects/Emails/Model/AssociatedId.php index 43fe80b6a..ca8b86732 100644 --- a/codegen/Crm/Objects/Emails/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Emails/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/AssociationSpec.php b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php index 70eae8f9d..a53253fe5 100644 --- a/codegen/Crm/Objects/Emails/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php index 651976914..25ad6eaa1 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 8162d22d7..6e951268e 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index f7e88a622..207cb92ab 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php index de72387e6..6d853b12c 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php index 950eaa0c9..25d6a5d61 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php index 65a4e57a1..a164ec2a8 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php index 47b085d3a..9af89f033 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php index 6799355e0..ab4b8a382 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 5fc00e926..7eb39b6c7 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php index 592640366..fd1f05244 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 514819b2b..ea91fb5ec 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 5915b8f22..ea8ca5852 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/Error.php b/codegen/Crm/Objects/Emails/Model/Error.php index bf4130afc..b3c36b9a5 100644 --- a/codegen/Crm/Objects/Emails/Model/Error.php +++ b/codegen/Crm/Objects/Emails/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/ErrorDetail.php b/codegen/Crm/Objects/Emails/Model/ErrorDetail.php index 0c302d891..4840ecfea 100644 --- a/codegen/Crm/Objects/Emails/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Emails/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/Filter.php b/codegen/Crm/Objects/Emails/Model/Filter.php index 4c93fd126..03d060a53 100644 --- a/codegen/Crm/Objects/Emails/Model/Filter.php +++ b/codegen/Crm/Objects/Emails/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/FilterGroup.php b/codegen/Crm/Objects/Emails/Model/FilterGroup.php index 2cf429b72..402d6d146 100644 --- a/codegen/Crm/Objects/Emails/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Emails/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Emails/Model/ForwardPaging.php b/codegen/Crm/Objects/Emails/Model/ForwardPaging.php index d6b1ba1b7..d4b445913 100644 --- a/codegen/Crm/Objects/Emails/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Emails/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Emails/Model/ModelInterface.php b/codegen/Crm/Objects/Emails/Model/ModelInterface.php index c275705c2..b842bd3a9 100644 --- a/codegen/Crm/Objects/Emails/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Emails/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Emails/Model/NextPage.php b/codegen/Crm/Objects/Emails/Model/NextPage.php index d1d635ed0..904296c23 100644 --- a/codegen/Crm/Objects/Emails/Model/NextPage.php +++ b/codegen/Crm/Objects/Emails/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/Paging.php b/codegen/Crm/Objects/Emails/Model/Paging.php index 4bb169d1e..a54ba6513 100644 --- a/codegen/Crm/Objects/Emails/Model/Paging.php +++ b/codegen/Crm/Objects/Emails/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/PreviousPage.php b/codegen/Crm/Objects/Emails/Model/PreviousPage.php index 249006f7e..a38d3b8bd 100644 --- a/codegen/Crm/Objects/Emails/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Emails/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php index 98baafe99..e9e0e19b1 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/PublicObjectId.php b/codegen/Crm/Objects/Emails/Model/PublicObjectId.php index dc2f261e6..2376802a6 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php index caa3499a0..0f03657fb 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php index 74b5e79d5..9105a08b6 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php index d7b54a2ab..e81759b59 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..34b4bd2e3 --- /dev/null +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputUpsert.php index 7b642fbcc..0a899f060 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php index ac74659a9..bad0cda14 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php index a3928c082..d3b5f710d 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php index 6c8e3b22e..8ee767c82 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php index 22d7318ed..5f9b03afd 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Emails/Model/SimplePublicUpsertObject.php index d6e036b65..ea4dd8e28 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Emails/Model/StandardError.php b/codegen/Crm/Objects/Emails/Model/StandardError.php index 245c6d054..1579aa2ec 100644 --- a/codegen/Crm/Objects/Emails/Model/StandardError.php +++ b/codegen/Crm/Objects/Emails/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php index e5b6e6b31..e1d8788a5 100644 --- a/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Emails/ObjectSerializer.php b/codegen/Crm/Objects/Emails/ObjectSerializer.php index 8b8f00588..717fe7874 100644 --- a/codegen/Crm/Objects/Emails/ObjectSerializer.php +++ b/codegen/Crm/Objects/Emails/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php index b7228f9fe..098cacd3a 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -131,11 +131,11 @@ public function getConfig() * Read * * @param string $feedback_submission_id feedback_submission_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response or if the response body is not in the expected format @@ -154,11 +154,11 @@ public function getById($feedback_submission_id, $properties = null, $properties * Read * * @param string $feedback_submission_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response or if the response body is not in the expected format @@ -191,18 +191,6 @@ public function getByIdWithHttpInfo($feedback_submission_id, $properties = null, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -261,6 +249,19 @@ public function getByIdWithHttpInfo($feedback_submission_id, $properties = null, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -318,11 +319,11 @@ public function getByIdWithHttpInfo($feedback_submission_id, $properties = null, * Read * * @param string $feedback_submission_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -344,11 +345,11 @@ function ($response) { * Read * * @param string $feedback_submission_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -399,11 +400,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $feedback_submission_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -551,12 +552,12 @@ public function getByIdRequest($feedback_submission_id, $properties = null, $pro * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response or if the response body is not in the expected format @@ -574,12 +575,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response or if the response body is not in the expected format @@ -612,18 +613,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -682,6 +671,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -738,12 +740,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -764,12 +766,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -819,12 +821,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php index e90b771d5..988b11dd0 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -128,7 +128,7 @@ public function getConfig() * Read a batch of feedback submissions by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response or if the response body is not in the expected format @@ -147,7 +147,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of feedback submissions by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\FeedbackSubmissions\ApiException on non-2xx response or if the response body is not in the expected format @@ -180,18 +180,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -277,6 +265,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -342,7 +343,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of feedback submissions by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -364,7 +365,7 @@ function ($response) { * Read a batch of feedback submissions by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -415,7 +416,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php b/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php index 368e04432..58555c980 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\FeedbackSubmissions\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/FeedbackSubmissions/ApiException.php b/codegen/Crm/Objects/FeedbackSubmissions/ApiException.php index 176b7522c..671fcc196 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/ApiException.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Configuration.php b/codegen/Crm/Objects/FeedbackSubmissions/Configuration.php index ea389d3ad..1739c6ca0 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Configuration.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/FeedbackSubmissions/HeaderSelector.php b/codegen/Crm/Objects/FeedbackSubmissions/HeaderSelector.php index df472494c..e8bf6a772 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/HeaderSelector.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php index 322f781fd..dec4b9e48 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php index 5780c661a..3dc90c121 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php index 42f61a034..44382a1ae 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObjectWithErrors.php index c3075e31a..165d8d126 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseAssociatedId.php index 3a1a954f3..26cc20861 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 5d06e29fc..3e96e6b5e 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 8212f5fbe..6191ce3a5 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/Error.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/Error.php index 8e63c47d2..56b71f721 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/Error.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/ErrorDetail.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/ErrorDetail.php index 5512f4abe..d3fd631a4 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/Filter.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/Filter.php index 9487b6820..9a27e700a 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/Filter.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/FilterGroup.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/FilterGroup.php index 149e1d23c..77597f384 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/FilterGroup.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/ForwardPaging.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/ForwardPaging.php index 8cd423b6e..e76084b8e 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/ModelInterface.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/ModelInterface.php index 443e68b14..f2fb0aa3d 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/ModelInterface.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/NextPage.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/NextPage.php index d83a3d07d..d8cdecf12 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/NextPage.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/Paging.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/Paging.php index 04775fdc1..0d1b59419 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/Paging.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/PreviousPage.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/PreviousPage.php index ba74bbf42..ebe2a4279 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/PreviousPage.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/PublicObjectSearchRequest.php index 9d6a98b78..a5a1aaa46 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php index 1e6ef1ad6..ce519336b 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectId.php index 4b8114c40..62a1dd6ae 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php index 81b084fa4..c9c187e8f 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php index 7acfec824..750c38d77 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php index b6a065eee..1f7dde1a5 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/FeedbackSubmissions/ObjectSerializer.php b/codegen/Crm/Objects/FeedbackSubmissions/ObjectSerializer.php index b4b44ae3d..145410e4e 100644 --- a/codegen/Crm/Objects/FeedbackSubmissions/ObjectSerializer.php +++ b/codegen/Crm/Objects/FeedbackSubmissions/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Goals/Api/BasicApi.php b/codegen/Crm/Objects/Goals/Api/BasicApi.php index 00c510c10..c970f2817 100644 --- a/codegen/Crm/Objects/Goals/Api/BasicApi.php +++ b/codegen/Crm/Objects/Goals/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -71,12 +71,21 @@ class BasicApi /** @var string[] $contentTypes **/ public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], 'getById' => [ 'application/json', ], 'getPage' => [ 'application/json', ], + 'update' => [ + 'application/json', + ], ]; /** @@ -86,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -126,48 +135,1045 @@ public function getConfig() } /** - * Operation getById + * Operation archive * - * Read + * Archive * * @param string $goal_target_id goal_target_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Goals\Model\Error + * @return void */ - public function getById($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function archive($goal_target_id, string $contentType = self::contentTypes['archive'][0]) { - list($response) = $this->getByIdWithHttpInfo($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + $this->archiveWithHttpInfo($goal_target_id, $contentType); + } + + /** + * Operation archiveWithHttpInfo + * + * Archive + * + * @param string $goal_target_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($goal_target_id, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($goal_target_id, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Archive + * + * @param string $goal_target_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($goal_target_id, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($goal_target_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Archive + * + * @param string $goal_target_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($goal_target_id, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($goal_target_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'archive' + * + * @param string $goal_target_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($goal_target_id, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'goal_target_id' is set + if ($goal_target_id === null || (is_array($goal_target_id) && count($goal_target_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $goal_target_id when calling archive' + ); + } + + + $resourcePath = '/crm/v3/objects/goal_targets/{goalTargetId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($goal_target_id !== null) { + $resourcePath = str_replace( + '{' . 'goalTargetId' . '}', + ObjectSerializer::toPathValue($goal_target_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\Error + */ + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); return $response; } /** - * Operation getByIdWithHttpInfo + * Operation createWithHttpInfo + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($simple_public_object_input_for_create, $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 201: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject' !== '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\Objects\Goals\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\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\Objects\Goals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject'; + $request = $this->createRequest($simple_public_object_input_for_create, $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 'create' + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + + // verify the required parameter 'simple_public_object_input_for_create' is set + if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $simple_public_object_input_for_create when calling create' + ); + } + + + $resourcePath = '/crm/v3/objects/goal_targets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($simple_public_object_input_for_create)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + } else { + $httpBody = $simple_public_object_input_for_create; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getById + * + * Read + * + * @param string $goal_target_id goal_target_id (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Goals\Model\Error + */ + public function getById($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + list($response) = $this->getByIdWithHttpInfo($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + return $response; + } + + /** + * Operation getByIdWithHttpInfo + * + * Read + * + * @param string $goal_target_id (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function getByIdWithHttpInfo($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + $request = $this->getByIdRequest($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $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: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations' !== '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\Objects\Goals\Model\SimplePublicObjectWithAssociations', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\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\Objects\Goals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getByIdAsync + * + * Read + * + * @param string $goal_target_id (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsync($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + return $this->getByIdAsyncWithHttpInfo($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getByIdAsyncWithHttpInfo + * + * Read + * + * @param string $goal_target_id (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getByIdAsyncWithHttpInfo($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations'; + $request = $this->getByIdRequest($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $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 'getById' + * + * @param string $goal_target_id (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getByIdRequest($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + { + + // verify the required parameter 'goal_target_id' is set + if ($goal_target_id === null || (is_array($goal_target_id) && count($goal_target_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $goal_target_id when calling getById' + ); + } + + + + + + + + $resourcePath = '/crm/v3/objects/goal_targets/{goalTargetId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties, + 'properties', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $properties_with_history, + 'propertiesWithHistory', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $associations, + 'associations', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $archived, + 'archived', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_property, + 'idProperty', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($goal_target_id !== null) { + $resourcePath = str_replace( + '{' . 'goalTargetId' . '}', + ObjectSerializer::toPathValue($goal_target_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $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 + ); + } + + /** + * Operation getPage + * + * List + * + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Goals\Model\Error + */ + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + { + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + return $response; + } + + /** + * Operation getPageWithHttpInfo * - * Read + * List * - * @param string $goal_target_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getByIdRequest($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -191,26 +1197,14 @@ public function getByIdWithHttpInfo($goal_target_id, $properties = null, $proper $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -228,7 +1222,7 @@ public function getByIdWithHttpInfo($goal_target_id, $properties = null, $proper } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -261,7 +1255,20 @@ public function getByIdWithHttpInfo($goal_target_id, $properties = null, $proper ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -294,7 +1301,7 @@ public function getByIdWithHttpInfo($goal_target_id, $properties = null, $proper case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -313,24 +1320,24 @@ public function getByIdWithHttpInfo($goal_target_id, $properties = null, $proper } /** - * Operation getByIdAsync + * Operation getPageAsync * - * Read + * List * - * @param string $goal_target_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getByIdAsyncWithHttpInfo($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -339,25 +1346,25 @@ function ($response) { } /** - * Operation getByIdAsyncWithHttpInfo + * Operation getPageAsyncWithHttpInfo * - * Read + * List * - * @param string $goal_target_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($goal_target_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -396,28 +1403,22 @@ function ($exception) { } /** - * Create request for operation 'getById' + * Create request for operation 'getPage' * - * @param string $goal_target_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($goal_target_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - // verify the required parameter 'goal_target_id' is set - if ($goal_target_id === null || (is_array($goal_target_id) && count($goal_target_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $goal_target_id when calling getById' - ); - } @@ -425,13 +1426,31 @@ public function getByIdRequest($goal_target_id, $properties = null, $properties_ - $resourcePath = '/crm/v3/objects/goal_targets/{goalTargetId}'; + $resourcePath = '/crm/v3/objects/goal_targets'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after, + 'after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $properties, @@ -468,25 +1487,8 @@ public function getByIdRequest($goal_target_id, $properties = null, $properties_ true, // explode false // required ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $id_property, - 'idProperty', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // path params - if ($goal_target_id !== null) { - $resourcePath = str_replace( - '{' . 'goalTargetId' . '}', - ObjectSerializer::toPathValue($goal_target_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -547,48 +1549,42 @@ public function getByIdRequest($goal_target_id, $properties = null, $properties_ } /** - * Operation getPage + * Operation update * - * List + * Update * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $goal_target_id goal_target_id (required) + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Goals\Model\Error + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\Error */ - public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function update($goal_target_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + list($response) = $this->updateWithHttpInfo($goal_target_id, $simple_public_object_input, $id_property, $contentType); return $response; } /** - * Operation getPageWithHttpInfo + * Operation updateWithHttpInfo * - * List + * Update * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $goal_target_id (required) + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function updateWithHttpInfo($goal_target_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + $request = $this->updateRequest($goal_target_id, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -612,26 +1608,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' === '\SplFileObject') { + if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { + if ('\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -649,7 +1633,7 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -682,7 +1666,20 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } - $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -715,7 +1712,7 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', + '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -734,24 +1731,21 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } /** - * Operation getPageAsync + * Operation updateAsync * - * List + * Update * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $goal_target_id (required) + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function updateAsync($goal_target_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) + return $this->updateAsyncWithHttpInfo($goal_target_id, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -760,25 +1754,22 @@ function ($response) { } /** - * Operation getPageAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * List + * Update * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $goal_target_id (required) + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function updateAsyncWithHttpInfo($goal_target_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObject'; + $request = $this->updateRequest($goal_target_id, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -817,30 +1808,36 @@ function ($exception) { } /** - * Create request for operation 'getPage' + * Create request for operation 'update' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $goal_target_id (required) + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) + public function updateRequest($goal_target_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'goal_target_id' is set + if ($goal_target_id === null || (is_array($goal_target_id) && count($goal_target_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $goal_target_id when calling update' + ); + } + // verify the required parameter 'simple_public_object_input' is set + if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $simple_public_object_input when calling update' + ); + } - - - - $resourcePath = '/crm/v3/objects/goal_targets'; + $resourcePath = '/crm/v3/objects/goal_targets/{goalTargetId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -849,60 +1846,23 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $after, - 'after', // param base name + $id_property, + 'idProperty', // param base name 'string', // openApiType 'form', // style true, // explode false // required ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $properties, - 'properties', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $properties_with_history, - 'propertiesWithHistory', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $associations, - 'associations', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $archived, - 'archived', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); + // path params + if ($goal_target_id !== null) { + $resourcePath = str_replace( + '{' . 'goalTargetId' . '}', + ObjectSerializer::toPathValue($goal_target_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -912,7 +1872,14 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($simple_public_object_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + } else { + $httpBody = $simple_public_object_input; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -955,7 +1922,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'PATCH', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/codegen/Crm/Objects/Goals/Api/BatchApi.php b/codegen/Crm/Objects/Goals/Api/BatchApi.php index 88b0b4d9e..ab6333ecf 100644 --- a/codegen/Crm/Objects/Goals/Api/BatchApi.php +++ b/codegen/Crm/Objects/Goals/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -71,9 +71,21 @@ class BatchApi /** @var string[] $contentTypes **/ public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], 'read' => [ 'application/json', ], + 'update' => [ + 'application/json', + ], + 'upsert' => [ + 'application/json', + ], ]; /** @@ -83,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -123,40 +135,37 @@ public function getConfig() } /** - * Operation read + * Operation archive * - * Read a batch of goal targets by internal ID, or unique property values + * Archive a batch of goal targets by ID * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error + * @return void */ - public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); - return $response; + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); } /** - * Operation readWithHttpInfo + * Operation archiveWithHttpInfo * - * Read a batch of goal targets by internal ID, or unique property values + * Archive a batch of goal targets by ID * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -180,21 +189,238 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Archive a batch of goal targets by ID + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Archive a batch of goal targets by ID + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = ''; + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'archive' + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_id' is set + if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_id when calling archive' + ); + } + + + $resourcePath = '/crm/v3/objects/goal_targets/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_id)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + } else { + $httpBody = $batch_input_simple_public_object_id; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation create + * + * Create a batch of goal targets + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error + */ + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create a batch of goal targets + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $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: + case 201: if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -277,6 +503,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -307,7 +546,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject', @@ -337,20 +576,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } /** - * Operation readAsync + * Operation createAsync * - * Read a batch of goal targets by internal ID, or unique property values + * Create a batch of goal targets * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -359,21 +597,20 @@ function ($response) { } /** - * Operation readAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Read a batch of goal targets by internal ID, or unique property values + * Create a batch of goal targets * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -412,35 +649,420 @@ function ($exception) { } /** - * Create request for operation 'read' + * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_read_input_simple_public_object_id' is set - if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_read_input_simple_public_object_id when calling read' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } - - $resourcePath = '/crm/v3/objects/goal_targets/batch/read'; + $resourcePath = '/crm/v3/objects/goal_targets/batch/create'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input_for_create)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input_for_create; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation read + * + * Read a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error + */ + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); + return $response; + } + + /** + * Operation readWithHttpInfo + * + * Read a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $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: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject' !== '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\Objects\Goals\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors' !== '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\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\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\Objects\Goals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation readAsync + * + * Read a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation readAsyncWithHttpInfo + * + * Read a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject'; + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $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 'read' + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) + { + + // verify the required parameter 'batch_read_input_simple_public_object_id' is set + if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_read_input_simple_public_object_id when calling read' + ); + } + + + + $resourcePath = '/crm/v3/objects/goal_targets/batch/read'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $archived, 'archived', // param base name @@ -460,12 +1082,774 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived ); // for model (json/xml) - if (isset($batch_read_input_simple_public_object_id)) { + if (isset($batch_read_input_simple_public_object_id)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + } else { + $httpBody = $batch_read_input_simple_public_object_id; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error + */ + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $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: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject' !== '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\Objects\Goals\Model\BatchResponseSimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors' !== '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\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\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\Objects\Goals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAsync + * + * Update a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAsyncWithHttpInfo + * + * Update a batch of goal targets by internal ID, or unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicObject'; + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $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 'update' + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set + if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input when calling update' + ); + } + + + $resourcePath = '/crm/v3/objects/goal_targets/batch/update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + } else { + $httpBody = $batch_input_simple_public_object_batch_input; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upsert + * + * Create or update a batch of goal targets by unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error + */ + public function upsert($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or update a batch of goal targets by unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Objects\Goals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Goals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $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: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject' !== '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\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObjectWithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObjectWithErrors' !== '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\Objects\Goals\Model\BatchResponseSimplePublicUpsertObjectWithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Objects\Goals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Objects\Goals\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\Objects\Goals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Goals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertAsync + * + * Create or update a batch of goal targets by unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or update a batch of goal targets by unique property values + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\BatchResponseSimplePublicUpsertObject'; + $request = $this->upsertRequest($batch_input_simple_public_object_batch_input_upsert, $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 'upsert' + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'batch_input_simple_public_object_batch_input_upsert' is set + if ($batch_input_simple_public_object_batch_input_upsert === null || (is_array($batch_input_simple_public_object_batch_input_upsert) && count($batch_input_simple_public_object_batch_input_upsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_simple_public_object_batch_input_upsert when calling upsert' + ); + } + + + $resourcePath = '/crm/v3/objects/goal_targets/batch/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_simple_public_object_batch_input_upsert)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_upsert)); } else { - $httpBody = $batch_read_input_simple_public_object_id; + $httpBody = $batch_input_simple_public_object_batch_input_upsert; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/codegen/Crm/Objects/Goals/Api/SearchApi.php b/codegen/Crm/Objects/Goals/Api/SearchApi.php index 688be4dfa..e9d5e2e15 100644 --- a/codegen/Crm/Objects/Goals/Api/SearchApi.php +++ b/codegen/Crm/Objects/Goals/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Goals\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Goals/ApiException.php b/codegen/Crm/Objects/Goals/ApiException.php index d385e5681..7d719445b 100644 --- a/codegen/Crm/Objects/Goals/ApiException.php +++ b/codegen/Crm/Objects/Goals/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Goals/Configuration.php b/codegen/Crm/Objects/Goals/Configuration.php index bd9d4c633..fc2196e5c 100644 --- a/codegen/Crm/Objects/Goals/Configuration.php +++ b/codegen/Crm/Objects/Goals/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Goals/HeaderSelector.php b/codegen/Crm/Objects/Goals/HeaderSelector.php index 76738071e..5f7f7d45b 100644 --- a/codegen/Crm/Objects/Goals/HeaderSelector.php +++ b/codegen/Crm/Objects/Goals/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Goals/Model/AssociatedId.php b/codegen/Crm/Objects/Goals/Model/AssociatedId.php index 7226439a8..508716798 100644 --- a/codegen/Crm/Objects/Goals/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Goals/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/AssociationSpec.php b/codegen/Crm/Objects/Goals/Model/AssociationSpec.php new file mode 100644 index 000000000..963045ff9 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/AssociationSpec.php @@ -0,0 +1,485 @@ + + */ +class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AssociationSpec'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'association_category' => 'string', + 'association_type_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'association_category' => null, + 'association_type_id' => 'int32' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'association_category' => 'associationCategory', + 'association_type_id' => 'associationTypeId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'association_category' => 'setAssociationCategory', + 'association_type_id' => 'setAssociationTypeId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'association_category' => 'getAssociationCategory', + 'association_type_id' => 'getAssociationTypeId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const ASSOCIATION_CATEGORY_HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'; + public const ASSOCIATION_CATEGORY_USER_DEFINED = 'USER_DEFINED'; + public const ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED = 'INTEGRATOR_DEFINED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAssociationCategoryAllowableValues() + { + return [ + self::ASSOCIATION_CATEGORY_HUBSPOT_DEFINED, + self::ASSOCIATION_CATEGORY_USER_DEFINED, + self::ASSOCIATION_CATEGORY_INTEGRATOR_DEFINED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'association_category', must be one of '%s'", + $this->container['association_category'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets association_category + * + * @return string + */ + public function getAssociationCategory() + { + return $this->container['association_category']; + } + + /** + * Sets association_category + * + * @param string $association_category association_category + * + * @return self + */ + public function setAssociationCategory($association_category) + { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } + $allowedValues = $this->getAssociationCategoryAllowableValues(); + if (!in_array($association_category, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'association_category', must be one of '%s'", + $association_category, + implode("', '", $allowedValues) + ) + ); + } + $this->container['association_category'] = $association_category; + + return $this; + } + + /** + * Gets association_type_id + * + * @return int + */ + public function getAssociationTypeId() + { + return $this->container['association_type_id']; + } + + /** + * Sets association_type_id + * + * @param int $association_type_id association_type_id + * + * @return self + */ + public function setAssociationTypeId($association_type_id) + { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } + $this->container['association_type_id'] = $association_type_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInput.php new file mode 100644 index 000000000..e5af64ae3 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInput.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInput[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInput[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInput[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..1faa99263 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInputForCreate[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInputForCreate[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php new file mode 100644 index 000000000..4405165f3 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInputUpsert[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInputUpsert[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectBatchInputUpsert[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectId.php new file mode 100644 index 000000000..2be6bb4ed --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/BatchInputSimplePublicObjectId.php @@ -0,0 +1,412 @@ + + */ +class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputSimplePublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectId[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicObjectId[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php index 6e3b4559f..2b488eb8f 100644 --- a/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Goals/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php index d881f4376..f755a3016 100644 --- a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObjectWithErrors.php index 785c6d173..c096d4c1b 100644 --- a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObject.php new file mode 100644 index 000000000..6fd1d8b07 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObject.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Cms/Performance/Model/PublicPerformanceResponse.php b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php similarity index 51% rename from codegen/Cms/Performance/Model/PublicPerformanceResponse.php rename to codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 4d4fb1f63..ff27be163 100644 --- a/codegen/Cms/Performance/Model/PublicPerformanceResponse.php +++ b/codegen/Crm/Objects/Goals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -1,23 +1,23 @@ */ -class PublicPerformanceResponse implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchResponseSimplePublicUpsertObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class PublicPerformanceResponse implements ModelInterface, ArrayAccess, \JsonSer * * @var string */ - protected static $openAPIModelName = 'PublicPerformanceResponse'; + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObjectWithErrors'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,13 +57,14 @@ class PublicPerformanceResponse implements ModelInterface, ArrayAccess, \JsonSer * @var string[] */ protected static $openAPITypes = [ - 'path' => 'string', - 'period' => 'string', - 'start_interval' => 'int', - 'data' => '\HubSpot\Client\Cms\Performance\Model\PerformanceView[]', - 'domain' => 'string', - 'interval' => 'string', - 'end_interval' => 'int' + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[]', + 'errors' => '\HubSpot\Client\Crm\Objects\Goals\Model\StandardError[]', + 'status' => 'string' ]; /** @@ -74,13 +75,14 @@ class PublicPerformanceResponse implements ModelInterface, ArrayAccess, \JsonSer * @psalm-var array */ protected static $openAPIFormats = [ - 'path' => null, - 'period' => null, - 'start_interval' => 'int64', - 'data' => null, - 'domain' => null, - 'interval' => null, - 'end_interval' => 'int64' + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null ]; /** @@ -89,13 +91,14 @@ class PublicPerformanceResponse implements ModelInterface, ArrayAccess, \JsonSer * @var boolean[] */ protected static array $openAPINullables = [ - 'path' => false, - 'period' => false, - 'start_interval' => false, - 'data' => false, - 'domain' => false, - 'interval' => false, - 'end_interval' => false + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false ]; /** @@ -184,13 +187,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'path' => 'path', - 'period' => 'period', - 'start_interval' => 'startInterval', - 'data' => 'data', - 'domain' => 'domain', - 'interval' => 'interval', - 'end_interval' => 'endInterval' + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' ]; /** @@ -199,13 +203,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'path' => 'setPath', - 'period' => 'setPeriod', - 'start_interval' => 'setStartInterval', - 'data' => 'setData', - 'domain' => 'setDomain', - 'interval' => 'setInterval', - 'end_interval' => 'setEndInterval' + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' ]; /** @@ -214,13 +219,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'path' => 'getPath', - 'period' => 'getPeriod', - 'start_interval' => 'getStartInterval', - 'data' => 'getData', - 'domain' => 'getDomain', - 'interval' => 'getInterval', - 'end_interval' => 'getEndInterval' + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' ]; /** @@ -264,66 +270,23 @@ public function getModelName() return self::$openAPIModelName; } - public const PERIOD_ONE_MINUTE = 'ONE_MINUTE'; - public const PERIOD_FIVE_MINUTES = 'FIVE_MINUTES'; - public const PERIOD_TEN_MINUTES = 'TEN_MINUTES'; - public const PERIOD_FIFTEEN_MINUTES = 'FIFTEEN_MINUTES'; - public const PERIOD_THIRTY_MINUTES = 'THIRTY_MINUTES'; - public const PERIOD_ONE_HOUR = 'ONE_HOUR'; - public const PERIOD_FOUR_HOURS = 'FOUR_HOURS'; - public const PERIOD_TWELVE_HOURS = 'TWELVE_HOURS'; - public const PERIOD_ONE_DAY = 'ONE_DAY'; - public const PERIOD_ONE_WEEK = 'ONE_WEEK'; - public const INTERVAL_ONE_MINUTE = 'ONE_MINUTE'; - public const INTERVAL_FIVE_MINUTES = 'FIVE_MINUTES'; - public const INTERVAL_TEN_MINUTES = 'TEN_MINUTES'; - public const INTERVAL_FIFTEEN_MINUTES = 'FIFTEEN_MINUTES'; - public const INTERVAL_THIRTY_MINUTES = 'THIRTY_MINUTES'; - public const INTERVAL_ONE_HOUR = 'ONE_HOUR'; - public const INTERVAL_FOUR_HOURS = 'FOUR_HOURS'; - public const INTERVAL_TWELVE_HOURS = 'TWELVE_HOURS'; - public const INTERVAL_ONE_DAY = 'ONE_DAY'; - public const INTERVAL_ONE_WEEK = 'ONE_WEEK'; + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; /** * Gets allowable values of the enum * * @return string[] */ - public function getPeriodAllowableValues() + public function getStatusAllowableValues() { return [ - self::PERIOD_ONE_MINUTE, - self::PERIOD_FIVE_MINUTES, - self::PERIOD_TEN_MINUTES, - self::PERIOD_FIFTEEN_MINUTES, - self::PERIOD_THIRTY_MINUTES, - self::PERIOD_ONE_HOUR, - self::PERIOD_FOUR_HOURS, - self::PERIOD_TWELVE_HOURS, - self::PERIOD_ONE_DAY, - self::PERIOD_ONE_WEEK, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getIntervalAllowableValues() - { - return [ - self::INTERVAL_ONE_MINUTE, - self::INTERVAL_FIVE_MINUTES, - self::INTERVAL_TEN_MINUTES, - self::INTERVAL_FIFTEEN_MINUTES, - self::INTERVAL_THIRTY_MINUTES, - self::INTERVAL_ONE_HOUR, - self::INTERVAL_FOUR_HOURS, - self::INTERVAL_TWELVE_HOURS, - self::INTERVAL_ONE_DAY, - self::INTERVAL_ONE_WEEK, + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, ]; } @@ -337,18 +300,19 @@ public function getIntervalAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('path', $data ?? [], null); - $this->setIfExists('period', $data ?? [], null); - $this->setIfExists('start_interval', $data ?? [], null); - $this->setIfExists('data', $data ?? [], null); - $this->setIfExists('domain', $data ?? [], null); - $this->setIfExists('interval', $data ?? [], null); - $this->setIfExists('end_interval', $data ?? [], null); + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** @@ -378,36 +342,27 @@ public function listInvalidProperties() { $invalidProperties = []; - $allowedValues = $this->getPeriodAllowableValues(); - if (!is_null($this->container['period']) && !in_array($this->container['period'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'period', must be one of '%s'", - $this->container['period'], - implode("', '", $allowedValues) - ); + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; } - - if ($this->container['start_interval'] === null) { - $invalidProperties[] = "'start_interval' can't be null"; + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; } - if ($this->container['data'] === null) { - $invalidProperties[] = "'data' can't be null"; + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; } - if ($this->container['interval'] === null) { - $invalidProperties[] = "'interval' can't be null"; + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; } - $allowedValues = $this->getIntervalAllowableValues(); - if (!is_null($this->container['interval']) && !in_array($this->container['interval'], $allowedValues, true)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value '%s' for 'interval', must be one of '%s'", - $this->container['interval'], + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], implode("', '", $allowedValues) ); } - if ($this->container['end_interval'] === null) { - $invalidProperties[] = "'end_interval' can't be null"; - } return $invalidProperties; } @@ -424,210 +379,227 @@ public function valid() /** - * Gets path + * Gets completed_at * - * @return string|null + * @return \DateTime */ - public function getPath() + public function getCompletedAt() { - return $this->container['path']; + return $this->container['completed_at']; } /** - * Sets path + * Sets completed_at * - * @param string|null $path path + * @param \DateTime $completed_at completed_at * * @return self */ - public function setPath($path) + public function setCompletedAt($completed_at) { - if (is_null($path)) { - throw new \InvalidArgumentException('non-nullable path cannot be null'); + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); } - $this->container['path'] = $path; + $this->container['completed_at'] = $completed_at; return $this; } /** - * Gets period + * Gets num_errors * - * @return string|null + * @return int|null */ - public function getPeriod() + public function getNumErrors() { - return $this->container['period']; + return $this->container['num_errors']; } /** - * Sets period + * Sets num_errors * - * @param string|null $period period + * @param int|null $num_errors num_errors * * @return self */ - public function setPeriod($period) + public function setNumErrors($num_errors) { - if (is_null($period)) { - throw new \InvalidArgumentException('non-nullable period cannot be null'); - } - $allowedValues = $this->getPeriodAllowableValues(); - if (!in_array($period, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'period', must be one of '%s'", - $period, - implode("', '", $allowedValues) - ) - ); + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); } - $this->container['period'] = $period; + $this->container['num_errors'] = $num_errors; return $this; } /** - * Gets start_interval + * Gets requested_at * - * @return int + * @return \DateTime|null */ - public function getStartInterval() + public function getRequestedAt() { - return $this->container['start_interval']; + return $this->container['requested_at']; } /** - * Sets start_interval + * Sets requested_at * - * @param int $start_interval start_interval + * @param \DateTime|null $requested_at requested_at * * @return self */ - public function setStartInterval($start_interval) + public function setRequestedAt($requested_at) { - if (is_null($start_interval)) { - throw new \InvalidArgumentException('non-nullable start_interval cannot be null'); + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); } - $this->container['start_interval'] = $start_interval; + $this->container['requested_at'] = $requested_at; return $this; } /** - * Gets data + * Gets started_at * - * @return \HubSpot\Client\Cms\Performance\Model\PerformanceView[] + * @return \DateTime */ - public function getData() + public function getStartedAt() { - return $this->container['data']; + return $this->container['started_at']; } /** - * Sets data + * Sets started_at * - * @param \HubSpot\Client\Cms\Performance\Model\PerformanceView[] $data data + * @param \DateTime $started_at started_at * * @return self */ - public function setData($data) + public function setStartedAt($started_at) { - if (is_null($data)) { - throw new \InvalidArgumentException('non-nullable data cannot be null'); + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); } - $this->container['data'] = $data; + $this->container['started_at'] = $started_at; return $this; } /** - * Gets domain + * Gets links * - * @return string|null + * @return array|null */ - public function getDomain() + public function getLinks() { - return $this->container['domain']; + return $this->container['links']; } /** - * Sets domain + * Sets links * - * @param string|null $domain domain + * @param array|null $links links * * @return self */ - public function setDomain($domain) + public function setLinks($links) { - if (is_null($domain)) { - throw new \InvalidArgumentException('non-nullable domain cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['domain'] = $domain; + $this->container['links'] = $links; return $this; } /** - * Gets interval + * Gets results * - * @return string + * @return \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[] */ - public function getInterval() + public function getResults() { - return $this->container['interval']; + return $this->container['results']; } /** - * Sets interval + * Sets results * - * @param string $interval interval + * @param \HubSpot\Client\Crm\Objects\Goals\Model\SimplePublicUpsertObject[] $results results * * @return self */ - public function setInterval($interval) + public function setResults($results) { - if (is_null($interval)) { - throw new \InvalidArgumentException('non-nullable interval cannot be null'); + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); } - $allowedValues = $this->getIntervalAllowableValues(); - if (!in_array($interval, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'interval', must be one of '%s'", - $interval, - implode("', '", $allowedValues) - ) - ); + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); } - $this->container['interval'] = $interval; + $this->container['errors'] = $errors; return $this; } /** - * Gets end_interval + * Gets status * - * @return int + * @return string */ - public function getEndInterval() + public function getStatus() { - return $this->container['end_interval']; + return $this->container['status']; } /** - * Sets end_interval + * Sets status * - * @param int $end_interval end_interval + * @param string $status status * * @return self */ - public function setEndInterval($end_interval) + public function setStatus($status) { - if (is_null($end_interval)) { - throw new \InvalidArgumentException('non-nullable end_interval cannot be null'); + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); } - $this->container['end_interval'] = $end_interval; + $this->container['status'] = $status; return $this; } diff --git a/codegen/Crm/Objects/Goals/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Goals/Model/CollectionResponseAssociatedId.php index 28db868db..0070f061f 100644 --- a/codegen/Crm/Objects/Goals/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Goals/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 2f52ddcce..1d55824ba 100644 --- a/codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Goals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Goals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index b652e4e5b..53475a15e 100644 --- a/codegen/Crm/Objects/Goals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Goals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/Error.php b/codegen/Crm/Objects/Goals/Model/Error.php index 8453667b9..9b5987a19 100644 --- a/codegen/Crm/Objects/Goals/Model/Error.php +++ b/codegen/Crm/Objects/Goals/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/ErrorDetail.php b/codegen/Crm/Objects/Goals/Model/ErrorDetail.php index 4487380d6..01630f6d5 100644 --- a/codegen/Crm/Objects/Goals/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Goals/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/Filter.php b/codegen/Crm/Objects/Goals/Model/Filter.php index 066861d2e..e78c5717d 100644 --- a/codegen/Crm/Objects/Goals/Model/Filter.php +++ b/codegen/Crm/Objects/Goals/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/FilterGroup.php b/codegen/Crm/Objects/Goals/Model/FilterGroup.php index 0ebb4822a..3aaf3930b 100644 --- a/codegen/Crm/Objects/Goals/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Goals/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Goals/Model/ForwardPaging.php b/codegen/Crm/Objects/Goals/Model/ForwardPaging.php index d4f93f47a..b7ca5d23c 100644 --- a/codegen/Crm/Objects/Goals/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Goals/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Goals/Model/ModelInterface.php b/codegen/Crm/Objects/Goals/Model/ModelInterface.php index fb63aefc2..40b588121 100644 --- a/codegen/Crm/Objects/Goals/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Goals/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Goals/Model/NextPage.php b/codegen/Crm/Objects/Goals/Model/NextPage.php index e3007ac95..e4faca614 100644 --- a/codegen/Crm/Objects/Goals/Model/NextPage.php +++ b/codegen/Crm/Objects/Goals/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/Paging.php b/codegen/Crm/Objects/Goals/Model/Paging.php index 3b78eede3..1939c4c0a 100644 --- a/codegen/Crm/Objects/Goals/Model/Paging.php +++ b/codegen/Crm/Objects/Goals/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/PreviousPage.php b/codegen/Crm/Objects/Goals/Model/PreviousPage.php index 23804080b..fff042d29 100644 --- a/codegen/Crm/Objects/Goals/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Goals/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Goals/Model/PublicAssociationsForObject.php new file mode 100644 index 000000000..57b56fcb5 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/PublicAssociationsForObject.php @@ -0,0 +1,449 @@ + + */ +class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicAssociationsForObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'types' => '\HubSpot\Client\Crm\Objects\Goals\Model\AssociationSpec[]', + 'to' => '\HubSpot\Client\Crm\Objects\Goals\Model\PublicObjectId' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'types' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'types' => 'types', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'types' => 'setTypes', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'types' => 'getTypes', + 'to' => 'getTo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('types', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets types + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\AssociationSpec[] + */ + public function getTypes() + { + return $this->container['types']; + } + + /** + * Sets types + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\AssociationSpec[] $types types + * + * @return self + */ + public function setTypes($types) + { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } + $this->container['types'] = $types; + + return $this; + } + + /** + * Gets to + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\PublicObjectId + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\PublicObjectId $to to + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/PublicObjectId.php b/codegen/Crm/Objects/Goals/Model/PublicObjectId.php new file mode 100644 index 000000000..ebf513e6f --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/PublicObjectId.php @@ -0,0 +1,412 @@ + + */ +class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Goals/Model/PublicObjectSearchRequest.php index 2430dea20..5169c8d1b 100644 --- a/codegen/Crm/Objects/Goals/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Goals/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php index f1e0f0b0c..444b7ace8 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Cms/Performance/Model/ErrorDetail.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInput.php similarity index 67% rename from codegen/Cms/Performance/Model/ErrorDetail.php rename to codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInput.php index d47676142..4cf38ce30 100644 --- a/codegen/Cms/Performance/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInput.php @@ -1,23 +1,23 @@ */ -class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable +class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'ErrorDetail'; + protected static $openAPIModelName = 'SimplePublicObjectBatchInput'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,11 +57,10 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', - 'code' => 'string', - 'in' => 'string', - 'context' => 'array', - 'message' => 'string' + 'id_property' => 'string', + 'object_write_trace_id' => 'string', + 'id' => 'string', + 'properties' => 'array' ]; /** @@ -72,11 +71,10 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, - 'code' => null, - 'in' => null, - 'context' => null, - 'message' => null + 'id_property' => null, + 'object_write_trace_id' => null, + 'id' => null, + 'properties' => null ]; /** @@ -85,11 +83,10 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, - 'code' => false, - 'in' => false, - 'context' => false, - 'message' => false + 'id_property' => false, + 'object_write_trace_id' => false, + 'id' => false, + 'properties' => false ]; /** @@ -178,11 +175,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', - 'code' => 'code', - 'in' => 'in', - 'context' => 'context', - 'message' => 'message' + 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', + 'id' => 'id', + 'properties' => 'properties' ]; /** @@ -191,11 +187,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', - 'code' => 'setCode', - 'in' => 'setIn', - 'context' => 'setContext', - 'message' => 'setMessage' + 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'id' => 'setId', + 'properties' => 'setProperties' ]; /** @@ -204,11 +199,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', - 'code' => 'getCode', - 'in' => 'getIn', - 'context' => 'getContext', - 'message' => 'getMessage' + 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'id' => 'getId', + 'properties' => 'getProperties' ]; /** @@ -263,16 +257,15 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('in', $data ?? [], null); - $this->setIfExists('context', $data ?? [], null); - $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); } /** @@ -302,8 +295,11 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['message'] === null) { - $invalidProperties[] = "'message' can't be null"; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; } return $invalidProperties; } @@ -321,136 +317,109 @@ public function valid() /** - * Gets sub_category + * Gets id_property * * @return string|null */ - public function getSubCategory() + public function getIdProperty() { - return $this->container['sub_category']; + return $this->container['id_property']; } /** - * Sets sub_category + * Sets id_property * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ - public function setSubCategory($sub_category) + public function setIdProperty($id_property) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['id_property'] = $id_property; return $this; } /** - * Gets code + * Gets object_write_trace_id * * @return string|null */ - public function getCode() + public function getObjectWriteTraceId() { - return $this->container['code']; + return $this->container['object_write_trace_id']; } /** - * Sets code + * Sets object_write_trace_id * - * @param string|null $code The status code associated with the error detail + * @param string|null $object_write_trace_id object_write_trace_id * * @return self */ - public function setCode($code) + public function setObjectWriteTraceId($object_write_trace_id) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); } - $this->container['code'] = $code; + $this->container['object_write_trace_id'] = $object_write_trace_id; return $this; } /** - * Gets in + * Gets id * - * @return string|null - */ - public function getIn() - { - return $this->container['in']; - } - - /** - * Sets in - * - * @param string|null $in The name of the field or parameter in which the error was found. - * - * @return self - */ - public function setIn($in) - { - if (is_null($in)) { - throw new \InvalidArgumentException('non-nullable in cannot be null'); - } - $this->container['in'] = $in; - - return $this; - } - - /** - * Gets context - * - * @return array|null + * @return string */ - public function getContext() + public function getId() { - return $this->container['context']; + return $this->container['id']; } /** - * Sets context + * Sets id * - * @param array|null $context Context about the error condition + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ - public function setContext($context) + public function setId($id) { - if (is_null($context)) { - throw new \InvalidArgumentException('non-nullable context cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['context'] = $context; + $this->container['id'] = $id; return $this; } /** - * Gets message + * Gets properties * - * @return string + * @return array */ - public function getMessage() + public function getProperties() { - return $this->container['message']; + return $this->container['properties']; } /** - * Sets message + * Sets properties * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param array $properties properties * * @return self */ - public function setMessage($message) + public function setProperties($properties) { - if (is_null($message)) { - throw new \InvalidArgumentException('non-nullable message cannot be null'); + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); } - $this->container['message'] = $message; + $this->container['properties'] = $properties; return $this; } diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..774a62871 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputUpsert.php new file mode 100644 index 000000000..c5bb7de58 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectBatchInputUpsert.php @@ -0,0 +1,517 @@ + + */ +class SimplePublicObjectBatchInputUpsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputUpsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id_property' => 'string', + 'object_write_trace_id' => 'string', + 'id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id_property' => null, + 'object_write_trace_id' => null, + 'id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_write_trace_id' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id_property' => 'idProperty', + 'object_write_trace_id' => 'objectWriteTraceId', + 'id' => 'id', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id_property' => 'setIdProperty', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'id' => 'setId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id_property' => 'getIdProperty', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'id' => 'getId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id_property + * + * @return string|null + */ + public function getIdProperty() + { + return $this->container['id_property']; + } + + /** + * Sets id_property + * + * @param string|null $id_property The name of a property whose values are unique for this object + * + * @return self + */ + public function setIdProperty($id_property) + { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } + $this->container['id_property'] = $id_property; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectId.php index 2674986e2..001fac328 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInput.php new file mode 100644 index 000000000..a184ece8f --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInput.php @@ -0,0 +1,412 @@ + + */ +class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectInput'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInputForCreate.php new file mode 100644 index 000000000..2b00d3389 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectInputForCreate.php @@ -0,0 +1,446 @@ + + */ +class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Goals\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php index e44aebcc8..cfdb73089 100644 --- a/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Goals/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Goals/Model/SimplePublicUpsertObject.php new file mode 100644 index 000000000..8cf83aca7 --- /dev/null +++ b/codegen/Crm/Objects/Goals/Model/SimplePublicUpsertObject.php @@ -0,0 +1,696 @@ + + */ +class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicUpsertObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'created_at' => '\DateTime', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'new' => 'bool', + 'properties_with_history' => 'array', + 'id' => 'string', + 'object_write_trace_id' => 'string', + 'properties' => 'array', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'created_at' => 'date-time', + 'archived' => null, + 'archived_at' => 'date-time', + 'new' => null, + 'properties_with_history' => null, + 'id' => null, + 'object_write_trace_id' => null, + 'properties' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'new' => false, + 'properties_with_history' => false, + 'id' => false, + 'object_write_trace_id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'created_at' => 'createdAt', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'new' => 'new', + 'properties_with_history' => 'propertiesWithHistory', + 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'new' => 'setNew', + 'properties_with_history' => 'setPropertiesWithHistory', + 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'new' => 'getNew', + 'properties_with_history' => 'getPropertiesWithHistory', + 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('new', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['new'] === null) { + $invalidProperties[] = "'new' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets archived + * + * @return bool|null + */ + public function getArchived() + { + return $this->container['archived']; + } + + /** + * Sets archived + * + * @param bool|null $archived archived + * + * @return self + */ + public function setArchived($archived) + { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } + $this->container['archived'] = $archived; + + return $this; + } + + /** + * Gets archived_at + * + * @return \DateTime|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param \DateTime|null $archived_at archived_at + * + * @return self + */ + public function setArchivedAt($archived_at) + { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets new + * + * @return bool + */ + public function getNew() + { + return $this->container['new']; + } + + /** + * Sets new + * + * @param bool $new new + * + * @return self + */ + public function setNew($new) + { + if (is_null($new)) { + throw new \InvalidArgumentException('non-nullable new cannot be null'); + } + $this->container['new'] = $new; + + return $this; + } + + /** + * Gets properties_with_history + * + * @return array|null + */ + public function getPropertiesWithHistory() + { + return $this->container['properties_with_history']; + } + + /** + * Sets properties_with_history + * + * @param array|null $properties_with_history properties_with_history + * + * @return self + */ + public function setPropertiesWithHistory($properties_with_history) + { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } + $this->container['properties_with_history'] = $properties_with_history; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Goals/Model/StandardError.php b/codegen/Crm/Objects/Goals/Model/StandardError.php index bd0e7b78c..85ae8315b 100644 --- a/codegen/Crm/Objects/Goals/Model/StandardError.php +++ b/codegen/Crm/Objects/Goals/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php index 7a5fc30af..7e1031dd2 100644 --- a/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Goals/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Goals/ObjectSerializer.php b/codegen/Crm/Objects/Goals/ObjectSerializer.php index a2c8d25aa..4c50f69b2 100644 --- a/codegen/Crm/Objects/Goals/ObjectSerializer.php +++ b/codegen/Crm/Objects/Goals/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/HeaderSelector.php b/codegen/Crm/Objects/HeaderSelector.php index b7b71813a..c1daafbbf 100644 --- a/codegen/Crm/Objects/HeaderSelector.php +++ b/codegen/Crm/Objects/HeaderSelector.php @@ -10,7 +10,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Leads/Api/BasicApi.php b/codegen/Crm/Objects/Leads/Api/BasicApi.php index 9c26c929b..08273dec2 100644 --- a/codegen/Crm/Objects/Leads/Api/BasicApi.php +++ b/codegen/Crm/Objects/Leads/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($leads_id, string $contentType = self::conte $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $leads_id leads_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($leads_id, $properties = null, $properties_with_history * Read * * @param string $leads_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($leads_id, $properties = null, $properties_w $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($leads_id, $properties = null, $properties_w ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($leads_id, $properties = null, $properties_w * Read * * @param string $leads_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $leads_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $leads_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($leads_id, $properties = null, $properties_with_h * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $leads_id leads_id (required) * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($leads_id, $simple_public_object_input, $id_property = nu * * @param string $leads_id (required) * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($leads_id, $simple_public_object_input, $id_p $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($leads_id, $simple_public_object_input, $id_p ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($leads_id, $simple_public_object_input, $id_p * * @param string $leads_id (required) * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $leads_id (required) * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $leads_id (required) * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Leads/Api/BatchApi.php b/codegen/Crm/Objects/Leads/Api/BatchApi.php index a0bf8342d..3944fb37e 100644 --- a/codegen/Crm/Objects/Leads/Api/BatchApi.php +++ b/codegen/Crm/Objects/Leads/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of leads * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Leads\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of leads * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Leads\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of leads * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of leads * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of leads by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of leads by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Leads\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of leads by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of leads by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Leads\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Leads/Api/SearchApi.php b/codegen/Crm/Objects/Leads/Api/SearchApi.php index a66f5e198..0c3932c2b 100644 --- a/codegen/Crm/Objects/Leads/Api/SearchApi.php +++ b/codegen/Crm/Objects/Leads/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Leads\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Leads/ApiException.php b/codegen/Crm/Objects/Leads/ApiException.php index 2b22cd340..90fd55283 100644 --- a/codegen/Crm/Objects/Leads/ApiException.php +++ b/codegen/Crm/Objects/Leads/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Leads/Configuration.php b/codegen/Crm/Objects/Leads/Configuration.php index 0ca9b3392..3d0964e8f 100644 --- a/codegen/Crm/Objects/Leads/Configuration.php +++ b/codegen/Crm/Objects/Leads/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Leads/HeaderSelector.php b/codegen/Crm/Objects/Leads/HeaderSelector.php index 24af14b16..24249749f 100644 --- a/codegen/Crm/Objects/Leads/HeaderSelector.php +++ b/codegen/Crm/Objects/Leads/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Leads/Model/AssociatedId.php b/codegen/Crm/Objects/Leads/Model/AssociatedId.php index 2783b9906..51ddb837f 100644 --- a/codegen/Crm/Objects/Leads/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Leads/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/AssociationSpec.php b/codegen/Crm/Objects/Leads/Model/AssociationSpec.php index 54a6c8436..0b81d6fc9 100644 --- a/codegen/Crm/Objects/Leads/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Leads/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInput.php index 54f680032..15a9c5dc0 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index e5f5d6a12..425514666 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Leads\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 3573afaed..b2c7e1766 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectId.php index 3ff4eb5e6..513dcceac 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Leads/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php index 2d700471c..c71a4b554 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Leads/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php index cc586b638..2f673dd9f 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObjectWithErrors.php index c4fafd323..b9eacd21c 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php index bd10b2488..336c00ffd 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 6e3662847..c45101e77 100644 --- a/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Leads/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Leads/Model/CollectionResponseAssociatedId.php index b19e9b8dc..791e32cd9 100644 --- a/codegen/Crm/Objects/Leads/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Leads/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Leads/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 0e25e9415..82974a526 100644 --- a/codegen/Crm/Objects/Leads/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Leads/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index a2901a48f..8b2be437a 100644 --- a/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Leads/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/Error.php b/codegen/Crm/Objects/Leads/Model/Error.php index e9e4a58f2..ea99b6418 100644 --- a/codegen/Crm/Objects/Leads/Model/Error.php +++ b/codegen/Crm/Objects/Leads/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/ErrorDetail.php b/codegen/Crm/Objects/Leads/Model/ErrorDetail.php index 32f85e08f..d19d75b6e 100644 --- a/codegen/Crm/Objects/Leads/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Leads/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/Filter.php b/codegen/Crm/Objects/Leads/Model/Filter.php index 324588af2..06c9ab6ab 100644 --- a/codegen/Crm/Objects/Leads/Model/Filter.php +++ b/codegen/Crm/Objects/Leads/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/FilterGroup.php b/codegen/Crm/Objects/Leads/Model/FilterGroup.php index ceb4e1e42..f7722d846 100644 --- a/codegen/Crm/Objects/Leads/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Leads/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Leads/Model/ForwardPaging.php b/codegen/Crm/Objects/Leads/Model/ForwardPaging.php index b84871a25..8053cc62d 100644 --- a/codegen/Crm/Objects/Leads/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Leads/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Leads/Model/ModelInterface.php b/codegen/Crm/Objects/Leads/Model/ModelInterface.php index 5fa37adf3..536bc3530 100644 --- a/codegen/Crm/Objects/Leads/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Leads/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Leads/Model/NextPage.php b/codegen/Crm/Objects/Leads/Model/NextPage.php index e66dc44b0..771eebb38 100644 --- a/codegen/Crm/Objects/Leads/Model/NextPage.php +++ b/codegen/Crm/Objects/Leads/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/Paging.php b/codegen/Crm/Objects/Leads/Model/Paging.php index ed07b3f3c..28a1cfae9 100644 --- a/codegen/Crm/Objects/Leads/Model/Paging.php +++ b/codegen/Crm/Objects/Leads/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/PreviousPage.php b/codegen/Crm/Objects/Leads/Model/PreviousPage.php index e1f1a5fbd..8d77bc63f 100644 --- a/codegen/Crm/Objects/Leads/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Leads/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Leads/Model/PublicAssociationsForObject.php index 1c32b2ac4..26986bbb8 100644 --- a/codegen/Crm/Objects/Leads/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Leads/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/PublicObjectId.php b/codegen/Crm/Objects/Leads/Model/PublicObjectId.php index f2f9fb880..201283957 100644 --- a/codegen/Crm/Objects/Leads/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Leads/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Leads/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Leads/Model/PublicObjectSearchRequest.php index 359b67c70..83ba92936 100644 --- a/codegen/Crm/Objects/Leads/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Leads/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php index aed364f85..b97c4c132 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInput.php index a1a0e83f0..da867c226 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..f737a2be1 --- /dev/null +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputUpsert.php index 91b7fc34b..80c99e110 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectId.php index 059275d28..62b9481ef 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php index 9c4d44ad2..fda6ef609 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php index 2222e6d03..2dc8b50a2 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Leads\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php index c61bbdecf..d46253ea1 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Leads/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Leads/Model/SimplePublicUpsertObject.php index 812891a28..99f9aa962 100644 --- a/codegen/Crm/Objects/Leads/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Leads/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Leads/Model/StandardError.php b/codegen/Crm/Objects/Leads/Model/StandardError.php index 87e660c10..39df05d22 100644 --- a/codegen/Crm/Objects/Leads/Model/StandardError.php +++ b/codegen/Crm/Objects/Leads/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php index e81713a17..582109126 100644 --- a/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Leads/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Leads/ObjectSerializer.php b/codegen/Crm/Objects/Leads/ObjectSerializer.php index c5c5a8cf1..baa4215d6 100644 --- a/codegen/Crm/Objects/Leads/ObjectSerializer.php +++ b/codegen/Crm/Objects/Leads/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Meetings/Api/BasicApi.php b/codegen/Crm/Objects/Meetings/Api/BasicApi.php index 4a1d4a27d..acac4ba2a 100644 --- a/codegen/Crm/Objects/Meetings/Api/BasicApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($meeting_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $meeting_id meeting_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($meeting_id, $properties = null, $properties_with_histor * Read * * @param string $meeting_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties * Read * * @param string $meeting_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $meeting_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $meeting_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($meeting_id, $properties = null, $properties_with * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $meeting_id meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($meeting_id, $simple_public_object_input, $id_property = * * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id * * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Meetings/Api/BatchApi.php b/codegen/Crm/Objects/Meetings/Api/BatchApi.php index 28f9aff6f..9a4e896eb 100644 --- a/codegen/Crm/Objects/Meetings/Api/BatchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of meetings * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of meetings * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of meetings * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of meetings * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of meetings by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of meetings by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of meetings by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of meetings by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Meetings/Api/SearchApi.php b/codegen/Crm/Objects/Meetings/Api/SearchApi.php index c45174554..1e2027e98 100644 --- a/codegen/Crm/Objects/Meetings/Api/SearchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Meetings/ApiException.php b/codegen/Crm/Objects/Meetings/ApiException.php index 9302b4e13..bf9d8a1d7 100644 --- a/codegen/Crm/Objects/Meetings/ApiException.php +++ b/codegen/Crm/Objects/Meetings/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Meetings/Configuration.php b/codegen/Crm/Objects/Meetings/Configuration.php index 296b091f2..f73f4d1f8 100644 --- a/codegen/Crm/Objects/Meetings/Configuration.php +++ b/codegen/Crm/Objects/Meetings/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Meetings/HeaderSelector.php b/codegen/Crm/Objects/Meetings/HeaderSelector.php index 066c235a3..238f1d33c 100644 --- a/codegen/Crm/Objects/Meetings/HeaderSelector.php +++ b/codegen/Crm/Objects/Meetings/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Meetings/Model/AssociatedId.php b/codegen/Crm/Objects/Meetings/Model/AssociatedId.php index 32f5d0b94..1b0324d60 100644 --- a/codegen/Crm/Objects/Meetings/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Meetings/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php index f1ea92ae0..dbceebedb 100644 --- a/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php index 66c6c8cf9..665434209 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 9728674e4..6ac1aabcd 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 841954ef8..0f11830a2 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php index e75de2e4c..336a6db7f 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php index e6b8ff2df..2fb214d82 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php index f2769e0e6..129ee3582 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php index 5c31780bc..cd53f3632 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php index ccd05a704..5bd3983c2 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index d30797629..0caade50d 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php index 8998739ff..f94f676eb 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 71c139c5a..93c9bf01b 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index affcd7c33..884899614 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/Error.php b/codegen/Crm/Objects/Meetings/Model/Error.php index 81a18ef55..cb01738d3 100644 --- a/codegen/Crm/Objects/Meetings/Model/Error.php +++ b/codegen/Crm/Objects/Meetings/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php b/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php index 09b56763e..5ce038756 100644 --- a/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/Filter.php b/codegen/Crm/Objects/Meetings/Model/Filter.php index 60d066f72..1ad860b20 100644 --- a/codegen/Crm/Objects/Meetings/Model/Filter.php +++ b/codegen/Crm/Objects/Meetings/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/FilterGroup.php b/codegen/Crm/Objects/Meetings/Model/FilterGroup.php index 2e4b9d876..19d49a1b5 100644 --- a/codegen/Crm/Objects/Meetings/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Meetings/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php b/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php index f8f4bfc72..1c134d756 100644 --- a/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Meetings/Model/ModelInterface.php b/codegen/Crm/Objects/Meetings/Model/ModelInterface.php index 3449cd8ae..d05a1d3fc 100644 --- a/codegen/Crm/Objects/Meetings/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Meetings/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Meetings/Model/NextPage.php b/codegen/Crm/Objects/Meetings/Model/NextPage.php index ef136e462..ef548b49b 100644 --- a/codegen/Crm/Objects/Meetings/Model/NextPage.php +++ b/codegen/Crm/Objects/Meetings/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/Paging.php b/codegen/Crm/Objects/Meetings/Model/Paging.php index 854328037..944530a29 100644 --- a/codegen/Crm/Objects/Meetings/Model/Paging.php +++ b/codegen/Crm/Objects/Meetings/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/PreviousPage.php b/codegen/Crm/Objects/Meetings/Model/PreviousPage.php index a0eb8abff..8b4e6f3e2 100644 --- a/codegen/Crm/Objects/Meetings/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Meetings/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php index b7255a224..4905566f5 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php index a1cfcfbd5..1160f010b 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php index 12d4d288d..b68c138f7 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php index 4c6cf235e..4b6e74e27 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php index 6c91192e2..0cca8ea8f 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..67f4eb464 --- /dev/null +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputUpsert.php index 8dfd117b2..d64ee3ab2 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php index 6653b9283..8b74179dd 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php index 63d7c2510..70ea4547f 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php index 3cf5f78f8..baf1895eb 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php index 15cda13bf..fa8639f37 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicUpsertObject.php index 4814365f3..a7a467379 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Meetings/Model/StandardError.php b/codegen/Crm/Objects/Meetings/Model/StandardError.php index f94b6fb6a..6aa2e92e6 100644 --- a/codegen/Crm/Objects/Meetings/Model/StandardError.php +++ b/codegen/Crm/Objects/Meetings/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php index d1eeb9060..f4abaa26d 100644 --- a/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Meetings/ObjectSerializer.php b/codegen/Crm/Objects/Meetings/ObjectSerializer.php index f54023b54..ed1d29159 100644 --- a/codegen/Crm/Objects/Meetings/ObjectSerializer.php +++ b/codegen/Crm/Objects/Meetings/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Model/AssociatedId.php b/codegen/Crm/Objects/Model/AssociatedId.php index cd76c0b94..9868381f8 100644 --- a/codegen/Crm/Objects/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Model/AssociatedId.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/AssociationSpec.php b/codegen/Crm/Objects/Model/AssociationSpec.php index 3b85b4cb2..75c5f5891 100644 --- a/codegen/Crm/Objects/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Model/AssociationSpec.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php index aae5b618c..28c7819b5 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInput.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 96% rename from codegen/Crm/Objects/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 8bd41b4be..7b98101d8 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 42f9c2157..c9a93d919 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php index ddcc5f239..b7e644df0 100644 --- a/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/BatchInputSimplePublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php index 40b8dc625..f4113bfb7 100644 --- a/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/BatchReadInputSimplePublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property The name of a property whose values are unique for this object + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php index 3e83c2831..dee1afa19 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php index e9d8c0556..5385ca6b8 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php index 1c5c7e6f0..ef0682356 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index ee7022ca5..7a6c23bf2 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Model/CollectionResponseAssociatedId.php index da694221c..6c2bd960c 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Model/CollectionResponseAssociatedId.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 10e373239..5df9cd881 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 312246297..501f6b1e7 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/Error.php b/codegen/Crm/Objects/Model/Error.php index 544db24f5..8ce2c792a 100644 --- a/codegen/Crm/Objects/Model/Error.php +++ b/codegen/Crm/Objects/Model/Error.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/ErrorDetail.php b/codegen/Crm/Objects/Model/ErrorDetail.php index 25689c15f..32e424683 100644 --- a/codegen/Crm/Objects/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Model/ErrorDetail.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/Filter.php b/codegen/Crm/Objects/Model/Filter.php index 9d8a8b6d2..1038680a7 100644 --- a/codegen/Crm/Objects/Model/Filter.php +++ b/codegen/Crm/Objects/Model/Filter.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/FilterGroup.php b/codegen/Crm/Objects/Model/FilterGroup.php index 56f09c67b..3d691217a 100644 --- a/codegen/Crm/Objects/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Model/FilterGroup.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/ForwardPaging.php b/codegen/Crm/Objects/Model/ForwardPaging.php index 2ef147383..2e02b4bab 100644 --- a/codegen/Crm/Objects/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Model/ForwardPaging.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/ModelInterface.php b/codegen/Crm/Objects/Model/ModelInterface.php index 7c5dd010c..1c1978735 100644 --- a/codegen/Crm/Objects/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Model/ModelInterface.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/NextPage.php b/codegen/Crm/Objects/Model/NextPage.php index 501122625..fa60b25cf 100644 --- a/codegen/Crm/Objects/Model/NextPage.php +++ b/codegen/Crm/Objects/Model/NextPage.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/Paging.php b/codegen/Crm/Objects/Model/Paging.php index 259bc825a..d28f10798 100644 --- a/codegen/Crm/Objects/Model/Paging.php +++ b/codegen/Crm/Objects/Model/Paging.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/PreviousPage.php b/codegen/Crm/Objects/Model/PreviousPage.php index 767841337..4e054f86e 100644 --- a/codegen/Crm/Objects/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Model/PreviousPage.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Model/PublicAssociationsForObject.php index 3c18abbe3..22f8787b5 100644 --- a/codegen/Crm/Objects/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Model/PublicAssociationsForObject.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/PublicObjectId.php b/codegen/Crm/Objects/Model/PublicObjectId.php index df006b226..070988fdc 100644 --- a/codegen/Crm/Objects/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Model/PublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php index 35d05e7fb..592bdf9e3 100644 --- a/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Model/PublicObjectSearchRequest.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/SimplePublicObject.php b/codegen/Crm/Objects/Model/SimplePublicObject.php index a185225a9..aeccdbd95 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Model/SimplePublicObject.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -285,6 +291,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php index d7be2a809..012349046 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInput.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..ed1c5d8c6 --- /dev/null +++ b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php index 350f81060..6eef5a66d 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectBatchInputUpsert.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Model/SimplePublicObjectId.php index 4e387fe2e..d07c29920 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectId.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Model/SimplePublicObjectInput.php index 2fc9742f8..5e368f0c6 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectInput.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -250,7 +244,6 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php index a4e024077..68073e3c0 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectInputForCreate.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -257,7 +251,6 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php index d0a0235ff..78da945b2 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php index 370b6e0cf..a12c7b6ca 100644 --- a/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Model/StandardError.php b/codegen/Crm/Objects/Model/StandardError.php index 0291c0c60..06f566396 100644 --- a/codegen/Crm/Objects/Model/StandardError.php +++ b/codegen/Crm/Objects/Model/StandardError.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Model/ValueWithTimestamp.php index a81127d9e..e7843e524 100644 --- a/codegen/Crm/Objects/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Model/ValueWithTimestamp.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/Notes/Api/BasicApi.php b/codegen/Crm/Objects/Notes/Api/BasicApi.php index b66384916..8d6d02357 100644 --- a/codegen/Crm/Objects/Notes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Notes/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($note_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $note_id note_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($note_id, $properties = null, $properties_with_history = * Read * * @param string $note_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($note_id, $properties = null, $properties_wi $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($note_id, $properties = null, $properties_wi ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($note_id, $properties = null, $properties_wi * Read * * @param string $note_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $note_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $note_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($note_id, $properties = null, $properties_with_hi * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $note_id note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($note_id, $simple_public_object_input, $id_property = nul * * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_pr $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_pr ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_pr * * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Notes/Api/BatchApi.php b/codegen/Crm/Objects/Notes/Api/BatchApi.php index d56b2b6c2..77a916917 100644 --- a/codegen/Crm/Objects/Notes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Notes/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of notes * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of notes * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of notes * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of notes * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of notes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of notes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of notes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of notes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Notes/Api/SearchApi.php b/codegen/Crm/Objects/Notes/Api/SearchApi.php index eeab284d3..d6ea7b6d4 100644 --- a/codegen/Crm/Objects/Notes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Notes/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Notes/ApiException.php b/codegen/Crm/Objects/Notes/ApiException.php index bb51660bb..d4608fc2e 100644 --- a/codegen/Crm/Objects/Notes/ApiException.php +++ b/codegen/Crm/Objects/Notes/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Notes/Configuration.php b/codegen/Crm/Objects/Notes/Configuration.php index 04b219e67..a1f2f05ef 100644 --- a/codegen/Crm/Objects/Notes/Configuration.php +++ b/codegen/Crm/Objects/Notes/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Notes/HeaderSelector.php b/codegen/Crm/Objects/Notes/HeaderSelector.php index 52af1b7eb..9d43b0ab9 100644 --- a/codegen/Crm/Objects/Notes/HeaderSelector.php +++ b/codegen/Crm/Objects/Notes/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Notes/Model/AssociatedId.php b/codegen/Crm/Objects/Notes/Model/AssociatedId.php index d79ce0c26..b37c38714 100644 --- a/codegen/Crm/Objects/Notes/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Notes/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/AssociationSpec.php b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php index 5e1629acf..05d312e48 100644 --- a/codegen/Crm/Objects/Notes/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php index 514c15727..8c719e585 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index d949b7ddc..53220be9f 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 777e22ea0..7e61eccb6 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php index dcb1395a3..b2c23b520 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php index 6f2c1e375..f63166ffb 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php index a3f999852..e965e0006 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php index aed9ac0bd..084bd3bab 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php index 1bc019079..2163a6720 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index e4a005837..92fbbe56c 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php index 7cdd8b2d7..3da5c513f 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 626d22474..fdbe20bfa 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index a3f93b755..694784f31 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/Error.php b/codegen/Crm/Objects/Notes/Model/Error.php index 28d02e5cb..52c5ee787 100644 --- a/codegen/Crm/Objects/Notes/Model/Error.php +++ b/codegen/Crm/Objects/Notes/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/ErrorDetail.php b/codegen/Crm/Objects/Notes/Model/ErrorDetail.php index 0402a63ce..a5469ad25 100644 --- a/codegen/Crm/Objects/Notes/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Notes/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/Filter.php b/codegen/Crm/Objects/Notes/Model/Filter.php index e206cb7db..6f543377e 100644 --- a/codegen/Crm/Objects/Notes/Model/Filter.php +++ b/codegen/Crm/Objects/Notes/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/FilterGroup.php b/codegen/Crm/Objects/Notes/Model/FilterGroup.php index 0f4166b64..02e8b1ad8 100644 --- a/codegen/Crm/Objects/Notes/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Notes/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Notes/Model/ForwardPaging.php b/codegen/Crm/Objects/Notes/Model/ForwardPaging.php index b7b70f41c..63db37f5c 100644 --- a/codegen/Crm/Objects/Notes/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Notes/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Notes/Model/ModelInterface.php b/codegen/Crm/Objects/Notes/Model/ModelInterface.php index a4b25dc37..12eb46665 100644 --- a/codegen/Crm/Objects/Notes/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Notes/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Notes/Model/NextPage.php b/codegen/Crm/Objects/Notes/Model/NextPage.php index 5db1f77c3..5375d88f9 100644 --- a/codegen/Crm/Objects/Notes/Model/NextPage.php +++ b/codegen/Crm/Objects/Notes/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/Paging.php b/codegen/Crm/Objects/Notes/Model/Paging.php index 8a99725da..7a1c5ba83 100644 --- a/codegen/Crm/Objects/Notes/Model/Paging.php +++ b/codegen/Crm/Objects/Notes/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/PreviousPage.php b/codegen/Crm/Objects/Notes/Model/PreviousPage.php index 41fe02f9d..680076973 100644 --- a/codegen/Crm/Objects/Notes/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Notes/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php index d2bb5a7d0..1e614bb96 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/PublicObjectId.php b/codegen/Crm/Objects/Notes/Model/PublicObjectId.php index 016f47c16..18f700b3d 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php index 88f55008e..39b6e88bc 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php index 1b1b45a22..fbb98aa7c 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php index 5b7dfd96c..e0946cbe4 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..2cf9d0286 --- /dev/null +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputUpsert.php index 92fd9deb7..e593143b8 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php index b6cd476c0..d019ac6cb 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php index d64629f5e..d42a2bc07 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php index 2dac36da6..341aa6c8d 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php index ea8791f10..2100cf04c 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Notes/Model/SimplePublicUpsertObject.php index 9291b3e62..bd9aa57cc 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Notes/Model/StandardError.php b/codegen/Crm/Objects/Notes/Model/StandardError.php index 06e033394..cf3a0a1b7 100644 --- a/codegen/Crm/Objects/Notes/Model/StandardError.php +++ b/codegen/Crm/Objects/Notes/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php index 0db389c6c..bd2ee916c 100644 --- a/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Notes/ObjectSerializer.php b/codegen/Crm/Objects/Notes/ObjectSerializer.php index 1320fe46e..e61281bef 100644 --- a/codegen/Crm/Objects/Notes/ObjectSerializer.php +++ b/codegen/Crm/Objects/Notes/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/ObjectSerializer.php b/codegen/Crm/Objects/ObjectSerializer.php index f5e30df84..d02aee983 100644 --- a/codegen/Crm/Objects/ObjectSerializer.php +++ b/codegen/Crm/Objects/ObjectSerializer.php @@ -11,7 +11,7 @@ */ /** - * Objects + * CRM Objects * * 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. * diff --git a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php index 67775cd40..45711f78f 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($postal_mail_id, string $contentType = self: $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $postal_mail_id postal_mail_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($postal_mail_id, $properties = null, $properties_with_hi * Read * * @param string $postal_mail_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $proper $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $proper ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $proper * Read * * @param string $postal_mail_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $postal_mail_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $postal_mail_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($postal_mail_id, $properties = null, $properties_ * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $postal_mail_id postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($postal_mail_id, $simple_public_object_input, $id_propert * * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, * * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php index da276b2bd..e562f8bc6 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of postal mail * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of postal mail * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of postal mail * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of postal mail * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of postal mail by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of postal mail by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of postal mail by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of postal mail by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php index a57e599b2..7df67c168 100644 --- a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/PostalMail/ApiException.php b/codegen/Crm/Objects/PostalMail/ApiException.php index 39cc65454..76a2fab99 100644 --- a/codegen/Crm/Objects/PostalMail/ApiException.php +++ b/codegen/Crm/Objects/PostalMail/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/PostalMail/Configuration.php b/codegen/Crm/Objects/PostalMail/Configuration.php index ee35fca7f..b1e611d42 100644 --- a/codegen/Crm/Objects/PostalMail/Configuration.php +++ b/codegen/Crm/Objects/PostalMail/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/PostalMail/HeaderSelector.php b/codegen/Crm/Objects/PostalMail/HeaderSelector.php index 09e22b153..2aa4d0b58 100644 --- a/codegen/Crm/Objects/PostalMail/HeaderSelector.php +++ b/codegen/Crm/Objects/PostalMail/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php index 6331f83eb..771ed06ec 100644 --- a/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php +++ b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php index fe6893a61..cbf2e6187 100644 --- a/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php index 08530c502..18416a756 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index a283c04d1..606f844d0 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 62fd15f45..4ad5e4298 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php index b07349a7e..2fc3d9cec 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php index afdc599ae..59410c482 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php index d77270ce1..fc8b5fc75 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php index 5b2cb0a3a..26db79ebd 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php index 77eadf629..f25433018 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 94d87eea0..14a24e7ba 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php index b5a8ceeac..ffe99a249 100644 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index c209d22a6..bf5f29669 100644 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 25f4c38b6..2e17ee574 100644 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/Error.php b/codegen/Crm/Objects/PostalMail/Model/Error.php index 2c84a8a89..63697dbf8 100644 --- a/codegen/Crm/Objects/PostalMail/Model/Error.php +++ b/codegen/Crm/Objects/PostalMail/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php b/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php index 3b6e47190..a6bcec17f 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/Filter.php b/codegen/Crm/Objects/PostalMail/Model/Filter.php index f183253a6..72c059b46 100644 --- a/codegen/Crm/Objects/PostalMail/Model/Filter.php +++ b/codegen/Crm/Objects/PostalMail/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php b/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php index 3548cbd2e..15c745de5 100644 --- a/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php +++ b/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php index f08b7cfe3..60bbaf1a6 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php b/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php index 6cbab3585..5ddda9ed7 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php +++ b/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/PostalMail/Model/NextPage.php b/codegen/Crm/Objects/PostalMail/Model/NextPage.php index 56c71baef..191a2f8bd 100644 --- a/codegen/Crm/Objects/PostalMail/Model/NextPage.php +++ b/codegen/Crm/Objects/PostalMail/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/Paging.php b/codegen/Crm/Objects/PostalMail/Model/Paging.php index 4fc35f716..81ee375bf 100644 --- a/codegen/Crm/Objects/PostalMail/Model/Paging.php +++ b/codegen/Crm/Objects/PostalMail/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php b/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php index 6a339e753..b75b4d439 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php +++ b/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php index c511c404b..e0dbe7c42 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php index 0dd660f9e..b1138b210 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php index dce91dec8..6d7c48ef8 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php index 97c9a59e4..66ee41b30 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php index 381177b63..d0c475f02 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..c08dfe732 --- /dev/null +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputUpsert.php index cf4ca9953..d1dc58b30 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php index 158354a8a..abbaa6efa 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php index d6c7e9b22..9426dc53f 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php index cf5f490a8..b942763a1 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php index c909c38f3..4809a1892 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicUpsertObject.php index af7244f4b..58fb7248a 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/PostalMail/Model/StandardError.php b/codegen/Crm/Objects/PostalMail/Model/StandardError.php index 8c5d25792..6c6d34157 100644 --- a/codegen/Crm/Objects/PostalMail/Model/StandardError.php +++ b/codegen/Crm/Objects/PostalMail/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php index 79241f4ec..611158aa2 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/PostalMail/ObjectSerializer.php b/codegen/Crm/Objects/PostalMail/ObjectSerializer.php index 12c730c44..dc2f7c22e 100644 --- a/codegen/Crm/Objects/PostalMail/ObjectSerializer.php +++ b/codegen/Crm/Objects/PostalMail/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Tasks/Api/BasicApi.php b/codegen/Crm/Objects/Tasks/Api/BasicApi.php index b67cfa0d4..588741c29 100644 --- a/codegen/Crm/Objects/Tasks/Api/BasicApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($task_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $task_id task_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($task_id, $properties = null, $properties_with_history = * Read * * @param string $task_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($task_id, $properties = null, $properties_wi $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($task_id, $properties = null, $properties_wi ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($task_id, $properties = null, $properties_wi * Read * * @param string $task_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $task_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $task_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($task_id, $properties = null, $properties_with_hi * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $task_id task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($task_id, $simple_public_object_input, $id_property = nul * * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_pr $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_pr ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_pr * * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Tasks/Api/BatchApi.php b/codegen/Crm/Objects/Tasks/Api/BatchApi.php index 808de9910..ff25011d7 100644 --- a/codegen/Crm/Objects/Tasks/Api/BatchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of tasks * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of tasks * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of tasks * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of tasks * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of tasks by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of tasks by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of tasks by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of tasks by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Tasks/Api/SearchApi.php b/codegen/Crm/Objects/Tasks/Api/SearchApi.php index 62187ee40..bafab46ec 100644 --- a/codegen/Crm/Objects/Tasks/Api/SearchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Tasks/ApiException.php b/codegen/Crm/Objects/Tasks/ApiException.php index 3d3542cf2..9550d6070 100644 --- a/codegen/Crm/Objects/Tasks/ApiException.php +++ b/codegen/Crm/Objects/Tasks/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Tasks/Configuration.php b/codegen/Crm/Objects/Tasks/Configuration.php index 912c1ef70..ed4223162 100644 --- a/codegen/Crm/Objects/Tasks/Configuration.php +++ b/codegen/Crm/Objects/Tasks/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Tasks/HeaderSelector.php b/codegen/Crm/Objects/Tasks/HeaderSelector.php index bf00a0ab0..1c8ac1723 100644 --- a/codegen/Crm/Objects/Tasks/HeaderSelector.php +++ b/codegen/Crm/Objects/Tasks/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Tasks/Model/AssociatedId.php b/codegen/Crm/Objects/Tasks/Model/AssociatedId.php index 74626980a..e80cc3aaa 100644 --- a/codegen/Crm/Objects/Tasks/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Tasks/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php index 4621d0115..2c77d71b1 100644 --- a/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php index 52e390181..991f66c90 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 0ddcd0c00..9d369272f 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 03cbcd5c8..477e250d7 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php index de6918967..73d300ab2 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php index 061d91230..93ca0c7ec 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php index 4e8f7974a..898b91302 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php index adbfa5f71..48eb634d2 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php index a4429aa18..10af46b84 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index a6c87d993..2327997ac 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php index 34530efaf..33b76ee30 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 0b0ec0a69..11a38fc27 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 2e0360cb4..c0b90ae6d 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/Error.php b/codegen/Crm/Objects/Tasks/Model/Error.php index 335fb48b3..abfcae89f 100644 --- a/codegen/Crm/Objects/Tasks/Model/Error.php +++ b/codegen/Crm/Objects/Tasks/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php b/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php index 912976a60..f5c1d0d4c 100644 --- a/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/Filter.php b/codegen/Crm/Objects/Tasks/Model/Filter.php index d7fda332a..096cde37b 100644 --- a/codegen/Crm/Objects/Tasks/Model/Filter.php +++ b/codegen/Crm/Objects/Tasks/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/FilterGroup.php b/codegen/Crm/Objects/Tasks/Model/FilterGroup.php index 1a4cafa78..452ed5d2b 100644 --- a/codegen/Crm/Objects/Tasks/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Tasks/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php b/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php index e6837b1eb..c2f4903bd 100644 --- a/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Tasks/Model/ModelInterface.php b/codegen/Crm/Objects/Tasks/Model/ModelInterface.php index b2c66ea6f..d3cde058a 100644 --- a/codegen/Crm/Objects/Tasks/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Tasks/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Tasks/Model/NextPage.php b/codegen/Crm/Objects/Tasks/Model/NextPage.php index 491bc3b62..fde92189d 100644 --- a/codegen/Crm/Objects/Tasks/Model/NextPage.php +++ b/codegen/Crm/Objects/Tasks/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/Paging.php b/codegen/Crm/Objects/Tasks/Model/Paging.php index a24a69f0a..4d9c318b6 100644 --- a/codegen/Crm/Objects/Tasks/Model/Paging.php +++ b/codegen/Crm/Objects/Tasks/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/PreviousPage.php b/codegen/Crm/Objects/Tasks/Model/PreviousPage.php index b108baab2..c38bab0b2 100644 --- a/codegen/Crm/Objects/Tasks/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Tasks/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php index 594957665..dde6b8db2 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php index 23745af81..9988e33b6 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php index 36d7e72a4..66c407259 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php index 798247447..2b596f45d 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php index e22a9e9d0..cad7f3922 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..3532599ee --- /dev/null +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputUpsert.php index baa76e406..bb1427db3 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php index 16fcf0efa..9847e3b81 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php index d4bead8b9..d622eb2ec 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php index 86ea1bd1e..23e31fca7 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php index 473acc6a4..8d175b598 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicUpsertObject.php index a7058f41b..2130da952 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Tasks/Model/StandardError.php b/codegen/Crm/Objects/Tasks/Model/StandardError.php index 4d5400f6b..1bc54f3cf 100644 --- a/codegen/Crm/Objects/Tasks/Model/StandardError.php +++ b/codegen/Crm/Objects/Tasks/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php index 8c78da7ff..46a2532a4 100644 --- a/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Tasks/ObjectSerializer.php b/codegen/Crm/Objects/Tasks/ObjectSerializer.php index a0abc13f5..64d71caad 100644 --- a/codegen/Crm/Objects/Tasks/ObjectSerializer.php +++ b/codegen/Crm/Objects/Tasks/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Objects/Taxes/Api/BasicApi.php b/codegen/Crm/Objects/Taxes/Api/BasicApi.php index 80f2749c2..4259e880e 100644 --- a/codegen/Crm/Objects/Taxes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($tax_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $tax_id tax_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($tax_id, $properties = null, $properties_with_history = * Read * * @param string $tax_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_wit $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_wit ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_wit * Read * * @param string $tax_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $tax_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $tax_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($tax_id, $properties = null, $properties_with_his * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $tax_id tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($tax_id, $simple_public_object_input, $id_property = null * * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_pro $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_pro ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_pro * * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Objects/Taxes/Api/BatchApi.php b/codegen/Crm/Objects/Taxes/Api/BatchApi.php index 4d1c58508..eb200d56f 100644 --- a/codegen/Crm/Objects/Taxes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of taxes * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of taxes * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of taxes * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of taxes * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of taxes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of taxes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of taxes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of taxes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Taxes/Api/SearchApi.php b/codegen/Crm/Objects/Taxes/Api/SearchApi.php index a05567719..fd8767915 100644 --- a/codegen/Crm/Objects/Taxes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Objects/Taxes/ApiException.php b/codegen/Crm/Objects/Taxes/ApiException.php index 76838fed3..ca9f2af10 100644 --- a/codegen/Crm/Objects/Taxes/ApiException.php +++ b/codegen/Crm/Objects/Taxes/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Objects/Taxes/Configuration.php b/codegen/Crm/Objects/Taxes/Configuration.php index 719532eb0..e0d2b8632 100644 --- a/codegen/Crm/Objects/Taxes/Configuration.php +++ b/codegen/Crm/Objects/Taxes/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Objects/Taxes/HeaderSelector.php b/codegen/Crm/Objects/Taxes/HeaderSelector.php index 2903e2e92..65586a8c1 100644 --- a/codegen/Crm/Objects/Taxes/HeaderSelector.php +++ b/codegen/Crm/Objects/Taxes/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Objects/Taxes/Model/AssociatedId.php b/codegen/Crm/Objects/Taxes/Model/AssociatedId.php index d62ee5876..09485d34d 100644 --- a/codegen/Crm/Objects/Taxes/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Taxes/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php b/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php index 51d0dae1e..8a5d45455 100644 --- a/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php index d0caeaa2c..1f8e1e01b 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 2654474c4..1591e7f7c 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index d50b9d45a..5285701f8 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php index 2badeaf19..3ecbe7a6d 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php index e73ece96b..97c0b27c5 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php index 89e538620..d1ca4b6e2 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php index c554f136a..c36a7df99 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php index 7240b8f34..89836b4c8 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 0a739fc46..fc98c851c 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php index fd9141926..8468b371c 100644 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 1638c0c88..a5a551126 100644 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 2e2a10d90..e27df2217 100644 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/Error.php b/codegen/Crm/Objects/Taxes/Model/Error.php index 3a57f7530..6ae7d89ec 100644 --- a/codegen/Crm/Objects/Taxes/Model/Error.php +++ b/codegen/Crm/Objects/Taxes/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php b/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php index a8871f4a4..bd1ce5b21 100644 --- a/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/Filter.php b/codegen/Crm/Objects/Taxes/Model/Filter.php index 76b541a0a..30cccf948 100644 --- a/codegen/Crm/Objects/Taxes/Model/Filter.php +++ b/codegen/Crm/Objects/Taxes/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/FilterGroup.php b/codegen/Crm/Objects/Taxes/Model/FilterGroup.php index 75f0efced..b0c2cdabc 100644 --- a/codegen/Crm/Objects/Taxes/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Taxes/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php b/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php index 27b71e89d..e8d0662d6 100644 --- a/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Taxes/Model/ModelInterface.php b/codegen/Crm/Objects/Taxes/Model/ModelInterface.php index 084bdd44e..1cce8815b 100644 --- a/codegen/Crm/Objects/Taxes/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Taxes/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Objects/Taxes/Model/NextPage.php b/codegen/Crm/Objects/Taxes/Model/NextPage.php index f532612fa..ec8b2ac3e 100644 --- a/codegen/Crm/Objects/Taxes/Model/NextPage.php +++ b/codegen/Crm/Objects/Taxes/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/Paging.php b/codegen/Crm/Objects/Taxes/Model/Paging.php index c4f569288..e1e9e742c 100644 --- a/codegen/Crm/Objects/Taxes/Model/Paging.php +++ b/codegen/Crm/Objects/Taxes/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/PreviousPage.php b/codegen/Crm/Objects/Taxes/Model/PreviousPage.php index a26690b76..74696d773 100644 --- a/codegen/Crm/Objects/Taxes/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Taxes/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php index 510c49912..dd6157910 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php index 99a5da991..195a80dec 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php index 9faf18ea6..60c9a12fa 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php index dc22dd350..358fe8e28 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php index 4a1cc9023..95ed5bc15 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..3dd2740af --- /dev/null +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputUpsert.php index a377e355f..170e79f61 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php index 538b7295a..806804b31 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php index 2b65fcbb2..d04cc38c3 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php index 0c13bd2bf..8b86985b5 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php index 9867054b4..51538c991 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicUpsertObject.php index d86a9109b..68c618ef7 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Objects/Taxes/Model/StandardError.php b/codegen/Crm/Objects/Taxes/Model/StandardError.php index dc731b923..5389cbb0b 100644 --- a/codegen/Crm/Objects/Taxes/Model/StandardError.php +++ b/codegen/Crm/Objects/Taxes/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php index 573eadbdb..7966dcfb9 100644 --- a/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Objects/Taxes/ObjectSerializer.php b/codegen/Crm/Objects/Taxes/ObjectSerializer.php index c6bb51837..0d4097639 100644 --- a/codegen/Crm/Objects/Taxes/ObjectSerializer.php +++ b/codegen/Crm/Objects/Taxes/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Owners/Api/OwnersApi.php b/codegen/Crm/Owners/Api/OwnersApi.php index a86f66539..df6596c52 100644 --- a/codegen/Crm/Owners/Api/OwnersApi.php +++ b/codegen/Crm/Owners/Api/OwnersApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class OwnersApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -131,8 +131,8 @@ public function getConfig() * Read an owner by given `id` or `userId` * * @param int $owner_id owner_id (required) - * @param string $id_property id_property (optional, default to 'id') - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property id_property (optional, default to 'id') + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Owners\ApiException on non-2xx response or if the response body is not in the expected format @@ -151,8 +151,8 @@ public function getById($owner_id, $id_property = 'id', $archived = false, strin * Read an owner by given `id` or `userId` * * @param int $owner_id (required) - * @param string $id_property (optional, default to 'id') - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property (optional, default to 'id') + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Owners\ApiException on non-2xx response or if the response body is not in the expected format @@ -185,18 +185,6 @@ public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -255,6 +243,19 @@ public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Owners\Model\PublicOwner'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -312,8 +313,8 @@ public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = * Read an owner by given `id` or `userId` * * @param int $owner_id (required) - * @param string $id_property (optional, default to 'id') - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property (optional, default to 'id') + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -335,8 +336,8 @@ function ($response) { * Read an owner by given `id` or `userId` * * @param int $owner_id (required) - * @param string $id_property (optional, default to 'id') - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property (optional, default to 'id') + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -387,8 +388,8 @@ function ($exception) { * Create request for operation 'getById' * * @param int $owner_id (required) - * @param string $id_property (optional, default to 'id') - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property (optional, default to 'id') + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -506,10 +507,10 @@ public function getByIdRequest($owner_id, $id_property = 'id', $archived = false * * Get a page of owners * - * @param string $email Filter by email address (optional) (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 100) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $email Filter by email address (optional) (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 100) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Owners\ApiException on non-2xx response or if the response body is not in the expected format @@ -527,10 +528,10 @@ public function getPage($email = null, $after = null, $limit = 100, $archived = * * Get a page of owners * - * @param string $email Filter by email address (optional) (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 100) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $email Filter by email address (optional) (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 100) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Owners\ApiException on non-2xx response or if the response body is not in the expected format @@ -563,18 +564,6 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -633,6 +622,19 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -689,10 +691,10 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, * * Get a page of owners * - * @param string $email Filter by email address (optional) (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 100) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $email Filter by email address (optional) (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 100) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -713,10 +715,10 @@ function ($response) { * * Get a page of owners * - * @param string $email Filter by email address (optional) (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 100) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $email Filter by email address (optional) (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 100) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -766,10 +768,10 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $email Filter by email address (optional) (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional, default to 100) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $email Filter by email address (optional) (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 100) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Owners/ApiException.php b/codegen/Crm/Owners/ApiException.php index 6ab5256b4..a7723fb57 100644 --- a/codegen/Crm/Owners/ApiException.php +++ b/codegen/Crm/Owners/ApiException.php @@ -10,13 +10,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Owners/Configuration.php b/codegen/Crm/Owners/Configuration.php index bec01b5df..112255014 100644 --- a/codegen/Crm/Owners/Configuration.php +++ b/codegen/Crm/Owners/Configuration.php @@ -10,13 +10,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Owners/HeaderSelector.php b/codegen/Crm/Owners/HeaderSelector.php index c01591c16..f10208c7b 100644 --- a/codegen/Crm/Owners/HeaderSelector.php +++ b/codegen/Crm/Owners/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Owners/Model/CollectionResponsePublicOwnerForwardPaging.php b/codegen/Crm/Owners/Model/CollectionResponsePublicOwnerForwardPaging.php index fd6fe1871..7f99a788a 100644 --- a/codegen/Crm/Owners/Model/CollectionResponsePublicOwnerForwardPaging.php +++ b/codegen/Crm/Owners/Model/CollectionResponsePublicOwnerForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Owners/Model/Error.php b/codegen/Crm/Owners/Model/Error.php index 64fa77931..791032eb9 100644 --- a/codegen/Crm/Owners/Model/Error.php +++ b/codegen/Crm/Owners/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Owners/Model/ErrorDetail.php b/codegen/Crm/Owners/Model/ErrorDetail.php index 568d562b4..72f539890 100644 --- a/codegen/Crm/Owners/Model/ErrorDetail.php +++ b/codegen/Crm/Owners/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Owners/Model/ForwardPaging.php b/codegen/Crm/Owners/Model/ForwardPaging.php index e7a8029e2..fb6c54139 100644 --- a/codegen/Crm/Owners/Model/ForwardPaging.php +++ b/codegen/Crm/Owners/Model/ForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Owners/Model/ModelInterface.php b/codegen/Crm/Owners/Model/ModelInterface.php index dffb17c47..9389c3e2b 100644 --- a/codegen/Crm/Owners/Model/ModelInterface.php +++ b/codegen/Crm/Owners/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Owners/Model/NextPage.php b/codegen/Crm/Owners/Model/NextPage.php index 7c4e2c9c2..5c8f000f2 100644 --- a/codegen/Crm/Owners/Model/NextPage.php +++ b/codegen/Crm/Owners/Model/NextPage.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Owners/Model/PublicOwner.php b/codegen/Crm/Owners/Model/PublicOwner.php index 5eb908965..7d11d40e4 100644 --- a/codegen/Crm/Owners/Model/PublicOwner.php +++ b/codegen/Crm/Owners/Model/PublicOwner.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -314,10 +314,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('first_name', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); diff --git a/codegen/Crm/Owners/Model/PublicTeam.php b/codegen/Crm/Owners/Model/PublicTeam.php index f3694b206..b960a9bf7 100644 --- a/codegen/Crm/Owners/Model/PublicTeam.php +++ b/codegen/Crm/Owners/Model/PublicTeam.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Crm/Owners/ObjectSerializer.php b/codegen/Crm/Owners/ObjectSerializer.php index 010489e5b..b4b0e34f9 100644 --- a/codegen/Crm/Owners/ObjectSerializer.php +++ b/codegen/Crm/Owners/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * CRM Crm Owners + * Crm Owners * * HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team(s) an owner can access, as well as which team is the owner's primary team. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Pipelines/Api/PipelineAuditsApi.php b/codegen/Crm/Pipelines/Api/PipelineAuditsApi.php index 749d0ecec..3e5e94232 100644 --- a/codegen/Crm/Pipelines/Api/PipelineAuditsApi.php +++ b/codegen/Crm/Pipelines/Api/PipelineAuditsApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class PipelineAuditsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -180,18 +180,6 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -250,6 +238,19 @@ public function getAuditWithHttpInfo($object_type, $pipeline_id, string $content ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php b/codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php index cf4359bff..485d57e00 100644 --- a/codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php +++ b/codegen/Crm/Pipelines/Api/PipelineStageAuditsApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class PipelineStageAuditsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -180,18 +180,6 @@ public function getAuditWithHttpInfo($object_type, $stage_id, string $contentTyp $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -250,6 +238,19 @@ public function getAuditWithHttpInfo($object_type, $stage_id, string $contentTyp ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePublicAuditInfoNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Pipelines/Api/PipelineStagesApi.php b/codegen/Crm/Pipelines/Api/PipelineStagesApi.php index a6741d75e..a73c55f6a 100644 --- a/codegen/Crm/Pipelines/Api/PipelineStagesApi.php +++ b/codegen/Crm/Pipelines/Api/PipelineStagesApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -98,13 +98,13 @@ class PipelineStagesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -196,18 +196,6 @@ public function archiveWithHttpInfo($object_type, $pipeline_id, $stage_id, strin $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -478,18 +466,6 @@ public function createWithHttpInfo($object_type, $pipeline_id, $pipeline_stage_i $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -548,6 +524,19 @@ public function createWithHttpInfo($object_type, $pipeline_id, $pipeline_stage_i ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -861,18 +850,6 @@ public function getAllWithHttpInfo($object_type, $pipeline_id, string $contentTy $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -931,6 +908,19 @@ public function getAllWithHttpInfo($object_type, $pipeline_id, string $contentTy ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineStageNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1229,18 +1219,6 @@ public function getByIdWithHttpInfo($object_type, $pipeline_id, $stage_id, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1299,6 +1277,19 @@ public function getByIdWithHttpInfo($object_type, $pipeline_id, $stage_id, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1617,18 +1608,6 @@ public function replaceWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipe $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function replaceWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipe ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2022,18 +2014,6 @@ public function updateWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipel $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2092,6 +2072,19 @@ public function updateWithHttpInfo($object_type, $pipeline_id, $stage_id, $pipel ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\PipelineStage'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Pipelines/Api/PipelinesApi.php b/codegen/Crm/Pipelines/Api/PipelinesApi.php index 1e815cbca..68f5695e5 100644 --- a/codegen/Crm/Pipelines/Api/PipelinesApi.php +++ b/codegen/Crm/Pipelines/Api/PipelinesApi.php @@ -10,13 +10,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -98,13 +98,13 @@ class PipelinesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -144,8 +144,8 @@ public function getConfig() * * @param string $object_type object_type (required) * @param string $pipeline_id pipeline_id (required) - * @param bool $validate_references_before_delete validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format @@ -164,8 +164,8 @@ public function archive($object_type, $pipeline_id, $validate_references_before_ * * @param string $object_type (required) * @param string $pipeline_id (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format @@ -198,18 +198,6 @@ public function archiveWithHttpInfo($object_type, $pipeline_id, $validate_refere $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -235,8 +223,8 @@ public function archiveWithHttpInfo($object_type, $pipeline_id, $validate_refere * * @param string $object_type (required) * @param string $pipeline_id (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -259,8 +247,8 @@ function ($response) { * * @param string $object_type (required) * @param string $pipeline_id (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -299,8 +287,8 @@ function ($exception) { * * @param string $object_type (required) * @param string $pipeline_id (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -486,18 +474,6 @@ public function createWithHttpInfo($object_type, $pipeline_input, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -556,6 +532,19 @@ public function createWithHttpInfo($object_type, $pipeline_input, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -849,18 +838,6 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -919,6 +896,19 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\CollectionResponsePipelineNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1197,18 +1187,6 @@ public function getByIdWithHttpInfo($object_type, $pipeline_id, string $contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1267,6 +1245,19 @@ public function getByIdWithHttpInfo($object_type, $pipeline_id, string $contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1513,8 +1504,8 @@ public function getByIdRequest($object_type, $pipeline_id, string $contentType = * @param string $object_type object_type (required) * @param string $pipeline_id pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input pipeline_input (required) - * @param bool $validate_references_before_delete validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format @@ -1535,8 +1526,8 @@ public function replace($object_type, $pipeline_id, $pipeline_input, $validate_r * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format @@ -1569,18 +1560,6 @@ public function replaceWithHttpInfo($object_type, $pipeline_id, $pipeline_input, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1639,6 +1618,19 @@ public function replaceWithHttpInfo($object_type, $pipeline_id, $pipeline_input, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1698,8 +1690,8 @@ public function replaceWithHttpInfo($object_type, $pipeline_id, $pipeline_input, * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1723,8 +1715,8 @@ function ($response) { * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1777,8 +1769,8 @@ function ($exception) { * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelineInput $pipeline_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1928,8 +1920,8 @@ public function replaceRequest($object_type, $pipeline_id, $pipeline_input, $val * @param string $object_type object_type (required) * @param string $pipeline_id pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input pipeline_patch_input (required) - * @param bool $validate_references_before_delete validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format @@ -1950,8 +1942,8 @@ public function update($object_type, $pipeline_id, $pipeline_patch_input, $valid * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Pipelines\ApiException on non-2xx response or if the response body is not in the expected format @@ -1984,18 +1976,6 @@ public function updateWithHttpInfo($object_type, $pipeline_id, $pipeline_patch_i $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2054,6 +2034,19 @@ public function updateWithHttpInfo($object_type, $pipeline_id, $pipeline_patch_i ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Pipelines\Model\Pipeline'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2113,8 +2106,8 @@ public function updateWithHttpInfo($object_type, $pipeline_id, $pipeline_patch_i * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2138,8 +2131,8 @@ function ($response) { * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2192,8 +2185,8 @@ function ($exception) { * @param string $object_type (required) * @param string $pipeline_id (required) * @param \HubSpot\Client\Crm\Pipelines\Model\PipelinePatchInput $pipeline_patch_input (required) - * @param bool $validate_references_before_delete (optional, default to false) - * @param bool $validate_deal_stage_usages_before_delete (optional, default to false) + * @param bool|null $validate_references_before_delete (optional, default to false) + * @param bool|null $validate_deal_stage_usages_before_delete (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Pipelines/ApiException.php b/codegen/Crm/Pipelines/ApiException.php index eccc63795..3638a8886 100644 --- a/codegen/Crm/Pipelines/ApiException.php +++ b/codegen/Crm/Pipelines/ApiException.php @@ -10,13 +10,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Pipelines/Configuration.php b/codegen/Crm/Pipelines/Configuration.php index 4f2af2047..3b6062f48 100644 --- a/codegen/Crm/Pipelines/Configuration.php +++ b/codegen/Crm/Pipelines/Configuration.php @@ -10,13 +10,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Pipelines/HeaderSelector.php b/codegen/Crm/Pipelines/HeaderSelector.php index 644edef46..d80703a10 100644 --- a/codegen/Crm/Pipelines/HeaderSelector.php +++ b/codegen/Crm/Pipelines/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Pipelines/Model/CollectionResponsePipelineNoPaging.php b/codegen/Crm/Pipelines/Model/CollectionResponsePipelineNoPaging.php index ded926990..9f13403b0 100644 --- a/codegen/Crm/Pipelines/Model/CollectionResponsePipelineNoPaging.php +++ b/codegen/Crm/Pipelines/Model/CollectionResponsePipelineNoPaging.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Pipelines/Model/CollectionResponsePipelineStageNoPaging.php b/codegen/Crm/Pipelines/Model/CollectionResponsePipelineStageNoPaging.php index 0ec277391..c65c29048 100644 --- a/codegen/Crm/Pipelines/Model/CollectionResponsePipelineStageNoPaging.php +++ b/codegen/Crm/Pipelines/Model/CollectionResponsePipelineStageNoPaging.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Pipelines/Model/CollectionResponsePublicAuditInfoNoPaging.php b/codegen/Crm/Pipelines/Model/CollectionResponsePublicAuditInfoNoPaging.php index 172f988c8..1c3873f39 100644 --- a/codegen/Crm/Pipelines/Model/CollectionResponsePublicAuditInfoNoPaging.php +++ b/codegen/Crm/Pipelines/Model/CollectionResponsePublicAuditInfoNoPaging.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Pipelines/Model/Error.php b/codegen/Crm/Pipelines/Model/Error.php index d871ee8a8..6de9f9957 100644 --- a/codegen/Crm/Pipelines/Model/Error.php +++ b/codegen/Crm/Pipelines/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/ErrorDetail.php b/codegen/Crm/Pipelines/Model/ErrorDetail.php index 38b893c3e..2c19b032a 100644 --- a/codegen/Crm/Pipelines/Model/ErrorDetail.php +++ b/codegen/Crm/Pipelines/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/ModelInterface.php b/codegen/Crm/Pipelines/Model/ModelInterface.php index d9e680c53..d1b936470 100644 --- a/codegen/Crm/Pipelines/Model/ModelInterface.php +++ b/codegen/Crm/Pipelines/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Pipelines/Model/Pipeline.php b/codegen/Crm/Pipelines/Model/Pipeline.php index 3d47d659a..368b5da8f 100644 --- a/codegen/Crm/Pipelines/Model/Pipeline.php +++ b/codegen/Crm/Pipelines/Model/Pipeline.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/PipelineInput.php b/codegen/Crm/Pipelines/Model/PipelineInput.php index 195541e17..3dc266676 100644 --- a/codegen/Crm/Pipelines/Model/PipelineInput.php +++ b/codegen/Crm/Pipelines/Model/PipelineInput.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('display_order', $data ?? [], null); $this->setIfExists('stages', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/PipelinePatchInput.php b/codegen/Crm/Pipelines/Model/PipelinePatchInput.php index 411080866..62c7065d9 100644 --- a/codegen/Crm/Pipelines/Model/PipelinePatchInput.php +++ b/codegen/Crm/Pipelines/Model/PipelinePatchInput.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/PipelineStage.php b/codegen/Crm/Pipelines/Model/PipelineStage.php index 9544071cc..17bce0637 100644 --- a/codegen/Crm/Pipelines/Model/PipelineStage.php +++ b/codegen/Crm/Pipelines/Model/PipelineStage.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -305,10 +305,10 @@ public function getWritePermissionsAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/PipelineStageInput.php b/codegen/Crm/Pipelines/Model/PipelineStageInput.php index 7b32e63c0..abf71b8e0 100644 --- a/codegen/Crm/Pipelines/Model/PipelineStageInput.php +++ b/codegen/Crm/Pipelines/Model/PipelineStageInput.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('metadata', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/PipelineStagePatchInput.php b/codegen/Crm/Pipelines/Model/PipelineStagePatchInput.php index 7c8933fbc..8dfb18c35 100644 --- a/codegen/Crm/Pipelines/Model/PipelineStagePatchInput.php +++ b/codegen/Crm/Pipelines/Model/PipelineStagePatchInput.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('metadata', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/Model/PublicAuditInfo.php b/codegen/Crm/Pipelines/Model/PublicAuditInfo.php index aeb3cec48..7806413a4 100644 --- a/codegen/Crm/Pipelines/Model/PublicAuditInfo.php +++ b/codegen/Crm/Pipelines/Model/PublicAuditInfo.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('identifier', $data ?? [], null); $this->setIfExists('raw_object', $data ?? [], null); diff --git a/codegen/Crm/Pipelines/ObjectSerializer.php b/codegen/Crm/Pipelines/ObjectSerializer.php index a46da2f82..cae9f224e 100644 --- a/codegen/Crm/Pipelines/ObjectSerializer.php +++ b/codegen/Crm/Pipelines/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * CRM Pipelines + * Pipelines * * Pipelines represent distinct stages in a workflow, like closing a deal or servicing a support ticket. These endpoints provide access to read and modify pipelines in HubSpot. Pipelines support `deals` and `tickets` object types. ## Pipeline ID validation When calling endpoints that take pipelineId as a parameter, that ID must correspond to an existing, un-archived pipeline. Otherwise the request will fail with a `404 Not Found` response. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Products/Api/BasicApi.php b/codegen/Crm/Products/Api/BasicApi.php index e2d1691ad..bf618bc69 100644 --- a/codegen/Crm/Products/Api/BasicApi.php +++ b/codegen/Crm/Products/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($product_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $product_id product_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($product_id, $properties = null, $properties_with_histor * Read * * @param string $product_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($product_id, $properties = null, $properties $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($product_id, $properties = null, $properties ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($product_id, $properties = null, $properties * Read * * @param string $product_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $product_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $product_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($product_id, $properties = null, $properties_with * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $product_id product_id (required) * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object. (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($product_id, $simple_public_object_input, $id_property = * * @param string $product_id (required) * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object. (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($product_id, $simple_public_object_input, $id $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($product_id, $simple_public_object_input, $id ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($product_id, $simple_public_object_input, $id * * @param string $product_id (required) * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object. (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $product_id (required) * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object. (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $product_id (required) * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object. (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Products/Api/BatchApi.php b/codegen/Crm/Products/Api/BatchApi.php index aafe6cbd1..914e82455 100644 --- a/codegen/Crm/Products/Api/BatchApi.php +++ b/codegen/Crm/Products/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of products * - * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Products\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of products * - * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Products\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of products * - * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of products * - * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Products\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of products by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Products\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of products by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Products\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Products\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of products by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Products\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of products by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Products\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Products\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Products/Api/SearchApi.php b/codegen/Crm/Products/Api/SearchApi.php index cd7b306ed..4cfcb623e 100644 --- a/codegen/Crm/Products/Api/SearchApi.php +++ b/codegen/Crm/Products/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Products\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Products/ApiException.php b/codegen/Crm/Products/ApiException.php index c73aae03a..3679d4c20 100644 --- a/codegen/Crm/Products/ApiException.php +++ b/codegen/Crm/Products/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Products/Configuration.php b/codegen/Crm/Products/Configuration.php index bb15bb2e8..cc20fb9f1 100644 --- a/codegen/Crm/Products/Configuration.php +++ b/codegen/Crm/Products/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Products/HeaderSelector.php b/codegen/Crm/Products/HeaderSelector.php index 67ac180c1..20a0f4a09 100644 --- a/codegen/Crm/Products/HeaderSelector.php +++ b/codegen/Crm/Products/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Products/Model/AssociatedId.php b/codegen/Crm/Products/Model/AssociatedId.php index f9409cad6..c04d17063 100644 --- a/codegen/Crm/Products/Model/AssociatedId.php +++ b/codegen/Crm/Products/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/AssociationSpec.php b/codegen/Crm/Products/Model/AssociationSpec.php index 5526a1322..2e2e4b340 100644 --- a/codegen/Crm/Products/Model/AssociationSpec.php +++ b/codegen/Crm/Products/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInput.php index 6d90a306e..d18530555 100644 --- a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Products/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 7d504330b..c17427160 100644 --- a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Products\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Products\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Products\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Products\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 1a75f00e7..6deba5a27 100644 --- a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectId.php index f84aaabd3..4493ea89c 100644 --- a/codegen/Crm/Products/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Products/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php index 0ca5aa339..83796e25c 100644 --- a/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Products/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property The name of a property whose values are unique for this object. + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php index 90a501f90..f8222bd58 100644 --- a/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Products/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Products/Model/BatchResponseSimplePublicObjectWithErrors.php index 67a75608c..d4df3522b 100644 --- a/codegen/Crm/Products/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Products/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php index 8fe620e43..d826e3c97 100644 --- a/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 9c30efd5f..776ab7114 100644 --- a/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Products/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Products/Model/CollectionResponseAssociatedId.php index e83ba2386..9c100b36d 100644 --- a/codegen/Crm/Products/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Products/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index ddc9db722..48237a370 100644 --- a/codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Products/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Products/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index ab2fd8f79..e3369e83d 100644 --- a/codegen/Crm/Products/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Products/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/Error.php b/codegen/Crm/Products/Model/Error.php index c3aa40e75..94fab4f93 100644 --- a/codegen/Crm/Products/Model/Error.php +++ b/codegen/Crm/Products/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/ErrorDetail.php b/codegen/Crm/Products/Model/ErrorDetail.php index 49efd13d7..bebc8b736 100644 --- a/codegen/Crm/Products/Model/ErrorDetail.php +++ b/codegen/Crm/Products/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/Filter.php b/codegen/Crm/Products/Model/Filter.php index 8b8e728f3..e506f67fc 100644 --- a/codegen/Crm/Products/Model/Filter.php +++ b/codegen/Crm/Products/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/FilterGroup.php b/codegen/Crm/Products/Model/FilterGroup.php index d7cf528e0..ac388cdee 100644 --- a/codegen/Crm/Products/Model/FilterGroup.php +++ b/codegen/Crm/Products/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Products/Model/ForwardPaging.php b/codegen/Crm/Products/Model/ForwardPaging.php index cea918f06..d2676b0c1 100644 --- a/codegen/Crm/Products/Model/ForwardPaging.php +++ b/codegen/Crm/Products/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Products/Model/ModelInterface.php b/codegen/Crm/Products/Model/ModelInterface.php index c1cfd81cb..4f174f79a 100644 --- a/codegen/Crm/Products/Model/ModelInterface.php +++ b/codegen/Crm/Products/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Products/Model/NextPage.php b/codegen/Crm/Products/Model/NextPage.php index f252b0bd0..19a722cc7 100644 --- a/codegen/Crm/Products/Model/NextPage.php +++ b/codegen/Crm/Products/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/Paging.php b/codegen/Crm/Products/Model/Paging.php index b27880b2f..2344c8461 100644 --- a/codegen/Crm/Products/Model/Paging.php +++ b/codegen/Crm/Products/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/PreviousPage.php b/codegen/Crm/Products/Model/PreviousPage.php index 20dfe1508..bc77072fd 100644 --- a/codegen/Crm/Products/Model/PreviousPage.php +++ b/codegen/Crm/Products/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/PublicAssociationsForObject.php b/codegen/Crm/Products/Model/PublicAssociationsForObject.php index fc4e31bb8..84dd199a8 100644 --- a/codegen/Crm/Products/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Products/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/PublicObjectId.php b/codegen/Crm/Products/Model/PublicObjectId.php index 31a13c77a..9b5c9c486 100644 --- a/codegen/Crm/Products/Model/PublicObjectId.php +++ b/codegen/Crm/Products/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Products/Model/PublicObjectSearchRequest.php b/codegen/Crm/Products/Model/PublicObjectSearchRequest.php index 0fb6c6fc7..d587446b8 100644 --- a/codegen/Crm/Products/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Products/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/SimplePublicObject.php b/codegen/Crm/Products/Model/SimplePublicObject.php index 27cda4854..c06637d77 100644 --- a/codegen/Crm/Products/Model/SimplePublicObject.php +++ b/codegen/Crm/Products/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Products/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Products/Model/SimplePublicObjectBatchInput.php index 0dfa3fa81..fe485c522 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Products/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..bfdfeb501 --- /dev/null +++ b/codegen/Crm/Products/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Products/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Products/Model/SimplePublicObjectBatchInputUpsert.php index 5a8da6d21..1affa1c24 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/SimplePublicObjectId.php b/codegen/Crm/Products/Model/SimplePublicObjectId.php index 6aad56db0..c41389a67 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Products/Model/SimplePublicObjectInput.php b/codegen/Crm/Products/Model/SimplePublicObjectInput.php index 453346280..f32eaed6b 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php index a052c32dc..616b4424b 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Products\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,6 +281,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } return $invalidProperties; } @@ -330,37 +326,10 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * - * @return array|null + * @return array */ public function getProperties() { @@ -370,7 +339,7 @@ public function getProperties() /** * Sets properties * - * @param array|null $properties properties + * @param array $properties properties * * @return self */ diff --git a/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php index c3d55db90..a0b4c703a 100644 --- a/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Products/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Products/Model/SimplePublicUpsertObject.php b/codegen/Crm/Products/Model/SimplePublicUpsertObject.php index afc4d8565..4da7a5768 100644 --- a/codegen/Crm/Products/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Products/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Products/Model/StandardError.php b/codegen/Crm/Products/Model/StandardError.php index 9f3d26cf9..04021c795 100644 --- a/codegen/Crm/Products/Model/StandardError.php +++ b/codegen/Crm/Products/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Products/Model/ValueWithTimestamp.php b/codegen/Crm/Products/Model/ValueWithTimestamp.php index 98d0a31c9..e0a3690f2 100644 --- a/codegen/Crm/Products/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Products/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Products/ObjectSerializer.php b/codegen/Crm/Products/ObjectSerializer.php index f60245fb0..eedf7f97d 100644 --- a/codegen/Crm/Products/ObjectSerializer.php +++ b/codegen/Crm/Products/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Properties/Api/BatchApi.php b/codegen/Crm/Properties/Api/BatchApi.php index 05c9c4f25..48d726e66 100644 --- a/codegen/Crm/Properties/Api/BatchApi.php +++ b/codegen/Crm/Properties/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -89,13 +89,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -185,18 +185,6 @@ public function archiveWithHttpInfo($object_type, $batch_input_property_name, st $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -446,18 +434,6 @@ public function createWithHttpInfo($object_type, $batch_input_property_create, s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -543,6 +519,19 @@ public function createWithHttpInfo($object_type, $batch_input_property_create, s ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -846,18 +835,6 @@ public function readWithHttpInfo($object_type, $batch_read_input_property_name, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -943,6 +920,19 @@ public function readWithHttpInfo($object_type, $batch_read_input_property_name, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Properties/Api/CoreApi.php b/codegen/Crm/Properties/Api/CoreApi.php index a5f099cfc..62785ee8a 100644 --- a/codegen/Crm/Properties/Api/CoreApi.php +++ b/codegen/Crm/Properties/Api/CoreApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class CoreApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -191,18 +191,6 @@ public function archiveWithHttpInfo($object_type, $property_name, string $conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -453,18 +441,6 @@ public function createWithHttpInfo($object_type, $property_create, string $conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -523,6 +499,19 @@ public function createWithHttpInfo($object_type, $property_create, string $conte ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\Property'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -766,8 +755,8 @@ public function createRequest($object_type, $property_create, string $contentTyp * Read all properties * * @param string $object_type object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,8 +775,8 @@ public function getAll($object_type, $archived = false, $properties = null, stri * Read all properties * * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format @@ -820,18 +809,6 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -890,6 +867,19 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -947,8 +937,8 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties * Read all properties * * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -970,8 +960,8 @@ function ($response) { * Read all properties * * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1022,8 +1012,8 @@ function ($exception) { * Create request for operation 'getAll' * * @param string $object_type (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1143,8 +1133,8 @@ public function getAllRequest($object_type, $archived = false, $properties = nul * * @param string $object_type object_type (required) * @param string $property_name property_name (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format @@ -1164,8 +1154,8 @@ public function getByName($object_type, $property_name, $archived = false, $prop * * @param string $object_type (required) * @param string $property_name (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format @@ -1198,18 +1188,6 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1268,6 +1246,19 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\Property'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1326,8 +1317,8 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = * * @param string $object_type (required) * @param string $property_name (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1350,8 +1341,8 @@ function ($response) { * * @param string $object_type (required) * @param string $property_name (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1403,8 +1394,8 @@ function ($exception) { * * @param string $object_type (required) * @param string $property_name (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $properties (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1592,18 +1583,6 @@ public function updateWithHttpInfo($object_type, $property_name, $property_updat $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1662,6 +1641,19 @@ public function updateWithHttpInfo($object_type, $property_name, $property_updat ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\Property'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Properties/Api/GroupsApi.php b/codegen/Crm/Properties/Api/GroupsApi.php index 86bdb774c..96617cd36 100644 --- a/codegen/Crm/Properties/Api/GroupsApi.php +++ b/codegen/Crm/Properties/Api/GroupsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class GroupsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -191,18 +191,6 @@ public function archiveWithHttpInfo($object_type, $group_name, string $contentTy $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -453,18 +441,6 @@ public function createWithHttpInfo($object_type, $property_group_create, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -523,6 +499,19 @@ public function createWithHttpInfo($object_type, $property_group_create, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -816,18 +805,6 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -886,6 +863,19 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1164,18 +1154,6 @@ public function getByNameWithHttpInfo($object_type, $group_name, string $content $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1234,6 +1212,19 @@ public function getByNameWithHttpInfo($object_type, $group_name, string $content ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1532,18 +1523,6 @@ public function updateWithHttpInfo($object_type, $group_name, $property_group_up $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1602,6 +1581,19 @@ public function updateWithHttpInfo($object_type, $group_name, $property_group_up ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Properties/ApiException.php b/codegen/Crm/Properties/ApiException.php index 50e1a179f..1c8fcede7 100644 --- a/codegen/Crm/Properties/ApiException.php +++ b/codegen/Crm/Properties/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Properties/Configuration.php b/codegen/Crm/Properties/Configuration.php index e6380bd8f..21e101254 100644 --- a/codegen/Crm/Properties/Configuration.php +++ b/codegen/Crm/Properties/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Properties/HeaderSelector.php b/codegen/Crm/Properties/HeaderSelector.php index 76d4939d5..46429c12c 100644 --- a/codegen/Crm/Properties/HeaderSelector.php +++ b/codegen/Crm/Properties/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Properties/Model/BatchInputPropertyCreate.php b/codegen/Crm/Properties/Model/BatchInputPropertyCreate.php index 14a002a3a..8ea1f09e1 100644 --- a/codegen/Crm/Properties/Model/BatchInputPropertyCreate.php +++ b/codegen/Crm/Properties/Model/BatchInputPropertyCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Properties/Model/BatchInputPropertyName.php b/codegen/Crm/Properties/Model/BatchInputPropertyName.php index 1c20d1c4a..50c471d92 100644 --- a/codegen/Crm/Properties/Model/BatchInputPropertyName.php +++ b/codegen/Crm/Properties/Model/BatchInputPropertyName.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php b/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php index 9e7895296..e8baca237 100644 --- a/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php +++ b/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('inputs', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/BatchResponseProperty.php b/codegen/Crm/Properties/Model/BatchResponseProperty.php index 7cfae3af8..e224734c5 100644 --- a/codegen/Crm/Properties/Model/BatchResponseProperty.php +++ b/codegen/Crm/Properties/Model/BatchResponseProperty.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php b/codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php index d8241d71a..a55e826ee 100644 --- a/codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php +++ b/codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php b/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php index 7eb1aa2c8..99d26bb38 100644 --- a/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php +++ b/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php b/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php index 283f43c95..7eb3f06b3 100644 --- a/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php +++ b/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Properties/Model/Error.php b/codegen/Crm/Properties/Model/Error.php index d5d373d6f..44594743b 100644 --- a/codegen/Crm/Properties/Model/Error.php +++ b/codegen/Crm/Properties/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/ErrorDetail.php b/codegen/Crm/Properties/Model/ErrorDetail.php index f7c888247..6ae7f066d 100644 --- a/codegen/Crm/Properties/Model/ErrorDetail.php +++ b/codegen/Crm/Properties/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/ModelInterface.php b/codegen/Crm/Properties/Model/ModelInterface.php index ef2b9ee7c..08ffd98dc 100644 --- a/codegen/Crm/Properties/Model/ModelInterface.php +++ b/codegen/Crm/Properties/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Properties/Model/Option.php b/codegen/Crm/Properties/Model/Option.php index 105d0cd6f..aa2b71d06 100644 --- a/codegen/Crm/Properties/Model/Option.php +++ b/codegen/Crm/Properties/Model/Option.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/OptionInput.php b/codegen/Crm/Properties/Model/OptionInput.php index e461b9d94..f4aef774a 100644 --- a/codegen/Crm/Properties/Model/OptionInput.php +++ b/codegen/Crm/Properties/Model/OptionInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/Property.php b/codegen/Crm/Properties/Model/Property.php index bfee4da14..c3efe4923 100644 --- a/codegen/Crm/Properties/Model/Property.php +++ b/codegen/Crm/Properties/Model/Property.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -377,10 +377,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_user_id', $data ?? [], null); $this->setIfExists('hidden', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/PropertyCreate.php b/codegen/Crm/Properties/Model/PropertyCreate.php index eaf932b37..aa76d119a 100644 --- a/codegen/Crm/Properties/Model/PropertyCreate.php +++ b/codegen/Crm/Properties/Model/PropertyCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -371,10 +371,10 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/PropertyGroup.php b/codegen/Crm/Properties/Model/PropertyGroup.php index d2060d04a..ed1b5c039 100644 --- a/codegen/Crm/Properties/Model/PropertyGroup.php +++ b/codegen/Crm/Properties/Model/PropertyGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/PropertyGroupCreate.php b/codegen/Crm/Properties/Model/PropertyGroupCreate.php index 419cb80bd..fc2f7d576 100644 --- a/codegen/Crm/Properties/Model/PropertyGroupCreate.php +++ b/codegen/Crm/Properties/Model/PropertyGroupCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/PropertyGroupUpdate.php b/codegen/Crm/Properties/Model/PropertyGroupUpdate.php index a6cb2f2dd..d53187aa2 100644 --- a/codegen/Crm/Properties/Model/PropertyGroupUpdate.php +++ b/codegen/Crm/Properties/Model/PropertyGroupUpdate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('display_order', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/PropertyModificationMetadata.php b/codegen/Crm/Properties/Model/PropertyModificationMetadata.php index 6dcddd267..0a907da8e 100644 --- a/codegen/Crm/Properties/Model/PropertyModificationMetadata.php +++ b/codegen/Crm/Properties/Model/PropertyModificationMetadata.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('read_only_options', $data ?? [], null); $this->setIfExists('read_only_value', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/PropertyName.php b/codegen/Crm/Properties/Model/PropertyName.php index 629cec336..8f13ddc5c 100644 --- a/codegen/Crm/Properties/Model/PropertyName.php +++ b/codegen/Crm/Properties/Model/PropertyName.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('name', $data ?? [], null); } diff --git a/codegen/Crm/Properties/Model/PropertyUpdate.php b/codegen/Crm/Properties/Model/PropertyUpdate.php index bcda9d448..9fa68a240 100644 --- a/codegen/Crm/Properties/Model/PropertyUpdate.php +++ b/codegen/Crm/Properties/Model/PropertyUpdate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -347,10 +347,10 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('group_name', $data ?? [], null); $this->setIfExists('hidden', $data ?? [], null); diff --git a/codegen/Crm/Properties/Model/StandardError.php b/codegen/Crm/Properties/Model/StandardError.php index 29fbb2df4..d1f8053e4 100644 --- a/codegen/Crm/Properties/Model/StandardError.php +++ b/codegen/Crm/Properties/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Properties/ObjectSerializer.php b/codegen/Crm/Properties/ObjectSerializer.php index df07b41ba..2a070e5c7 100644 --- a/codegen/Crm/Properties/ObjectSerializer.php +++ b/codegen/Crm/Properties/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Quotes/Api/BasicApi.php b/codegen/Crm/Quotes/Api/BasicApi.php index f66c9ae2a..a09a48edd 100644 --- a/codegen/Crm/Quotes/Api/BasicApi.php +++ b/codegen/Crm/Quotes/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($quote_id, string $contentType = self::conte $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +715,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $quote_id quote_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +738,11 @@ public function getById($quote_id, $properties = null, $properties_with_history * Read * * @param string $quote_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +775,6 @@ public function getByIdWithHttpInfo($quote_id, $properties = null, $properties_w $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +833,19 @@ public function getByIdWithHttpInfo($quote_id, $properties = null, $properties_w ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +903,11 @@ public function getByIdWithHttpInfo($quote_id, $properties = null, $properties_w * Read * * @param string $quote_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +929,11 @@ function ($response) { * Read * * @param string $quote_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +984,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $quote_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1136,12 @@ public function getByIdRequest($quote_id, $properties = null, $properties_with_h * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1159,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1197,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1255,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1324,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1350,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1405,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1564,7 +1555,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $quote_id quote_id (required) * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1575,7 @@ public function update($quote_id, $simple_public_object_input, $id_property = nu * * @param string $quote_id (required) * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1608,6 @@ public function updateWithHttpInfo($quote_id, $simple_public_object_input, $id_p $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1666,19 @@ public function updateWithHttpInfo($quote_id, $simple_public_object_input, $id_p ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +1737,7 @@ public function updateWithHttpInfo($quote_id, $simple_public_object_input, $id_p * * @param string $quote_id (required) * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +1760,7 @@ function ($response) { * * @param string $quote_id (required) * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +1812,7 @@ function ($exception) { * * @param string $quote_id (required) * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Quotes/Api/BatchApi.php b/codegen/Crm/Quotes/Api/BatchApi.php index 319fa3d49..909984220 100644 --- a/codegen/Crm/Quotes/Api/BatchApi.php +++ b/codegen/Crm/Quotes/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of quotes * - * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Quotes\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of quotes * - * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Quotes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of quotes * - * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of quotes * - * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Quotes\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of quotes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Quotes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of quotes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Quotes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Quotes\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of quotes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Quotes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of quotes by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Quotes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Quotes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Quotes/Api/SearchApi.php b/codegen/Crm/Quotes/Api/SearchApi.php index 6d344978d..c0807dd27 100644 --- a/codegen/Crm/Quotes/Api/SearchApi.php +++ b/codegen/Crm/Quotes/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Quotes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Quotes/ApiException.php b/codegen/Crm/Quotes/ApiException.php index 7853f6cf6..8a6ee643b 100644 --- a/codegen/Crm/Quotes/ApiException.php +++ b/codegen/Crm/Quotes/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Quotes/Configuration.php b/codegen/Crm/Quotes/Configuration.php index 2c772cd92..89f4603ed 100644 --- a/codegen/Crm/Quotes/Configuration.php +++ b/codegen/Crm/Quotes/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Quotes/HeaderSelector.php b/codegen/Crm/Quotes/HeaderSelector.php index 3ff0b05f6..1f16081c8 100644 --- a/codegen/Crm/Quotes/HeaderSelector.php +++ b/codegen/Crm/Quotes/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Quotes/Model/AssociatedId.php b/codegen/Crm/Quotes/Model/AssociatedId.php index 6ab301772..dd91340ee 100644 --- a/codegen/Crm/Quotes/Model/AssociatedId.php +++ b/codegen/Crm/Quotes/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/AssociationSpec.php b/codegen/Crm/Quotes/Model/AssociationSpec.php index 6433584c7..ef64d3f63 100644 --- a/codegen/Crm/Quotes/Model/AssociationSpec.php +++ b/codegen/Crm/Quotes/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInput.php index 0296cb481..d6f15e457 100644 --- a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 5f34d9d35..4f69212d6 100644 --- a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Quotes\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 7f9883697..5a35e23f3 100644 --- a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectId.php index cfeddc8c8..004a3c9a6 100644 --- a/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Quotes/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php index 19764a3a0..c03be1f60 100644 --- a/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Quotes/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php index 36a0e4bac..9ece6b0d7 100644 --- a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObjectWithErrors.php index ff27b9d8e..9500a81c9 100644 --- a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php index 337a2b567..ded553081 100644 --- a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index e55a16e9d..83fdcd7d9 100644 --- a/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Quotes/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Quotes/Model/CollectionResponseAssociatedId.php index f1c19a1b8..bf69dced2 100644 --- a/codegen/Crm/Quotes/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Quotes/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 6ead8106e..4272081e7 100644 --- a/codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Quotes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Quotes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 989cc7f73..33fe00270 100644 --- a/codegen/Crm/Quotes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Quotes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/Error.php b/codegen/Crm/Quotes/Model/Error.php index f41dc9530..8924a1f0c 100644 --- a/codegen/Crm/Quotes/Model/Error.php +++ b/codegen/Crm/Quotes/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/ErrorDetail.php b/codegen/Crm/Quotes/Model/ErrorDetail.php index 79d4f8d0d..7ace5fb3e 100644 --- a/codegen/Crm/Quotes/Model/ErrorDetail.php +++ b/codegen/Crm/Quotes/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/Filter.php b/codegen/Crm/Quotes/Model/Filter.php index 56340a3db..95343efc0 100644 --- a/codegen/Crm/Quotes/Model/Filter.php +++ b/codegen/Crm/Quotes/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/FilterGroup.php b/codegen/Crm/Quotes/Model/FilterGroup.php index d8adc9421..deb0e18b1 100644 --- a/codegen/Crm/Quotes/Model/FilterGroup.php +++ b/codegen/Crm/Quotes/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Quotes/Model/ForwardPaging.php b/codegen/Crm/Quotes/Model/ForwardPaging.php index a4139a0f5..156797d40 100644 --- a/codegen/Crm/Quotes/Model/ForwardPaging.php +++ b/codegen/Crm/Quotes/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Quotes/Model/ModelInterface.php b/codegen/Crm/Quotes/Model/ModelInterface.php index ce0704091..845b11503 100644 --- a/codegen/Crm/Quotes/Model/ModelInterface.php +++ b/codegen/Crm/Quotes/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Quotes/Model/NextPage.php b/codegen/Crm/Quotes/Model/NextPage.php index bab432e25..928389f09 100644 --- a/codegen/Crm/Quotes/Model/NextPage.php +++ b/codegen/Crm/Quotes/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/Paging.php b/codegen/Crm/Quotes/Model/Paging.php index 3bf3c9ebc..65f436ce5 100644 --- a/codegen/Crm/Quotes/Model/Paging.php +++ b/codegen/Crm/Quotes/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/PreviousPage.php b/codegen/Crm/Quotes/Model/PreviousPage.php index bbc16d4f2..472d19dd1 100644 --- a/codegen/Crm/Quotes/Model/PreviousPage.php +++ b/codegen/Crm/Quotes/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/PublicAssociationsForObject.php b/codegen/Crm/Quotes/Model/PublicAssociationsForObject.php index 9422a87e3..d52f5ed6e 100644 --- a/codegen/Crm/Quotes/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Quotes/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/PublicObjectId.php b/codegen/Crm/Quotes/Model/PublicObjectId.php index 81395ce8b..86afd096f 100644 --- a/codegen/Crm/Quotes/Model/PublicObjectId.php +++ b/codegen/Crm/Quotes/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Quotes/Model/PublicObjectSearchRequest.php b/codegen/Crm/Quotes/Model/PublicObjectSearchRequest.php index b88c443fa..a05f8aef6 100644 --- a/codegen/Crm/Quotes/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Quotes/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/SimplePublicObject.php b/codegen/Crm/Quotes/Model/SimplePublicObject.php index 46cda4af2..de2777476 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObject.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInput.php index db0e92852..b546d92c9 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..7626c8ffb --- /dev/null +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputUpsert.php index 107f342b9..8e38e0377 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectId.php b/codegen/Crm/Quotes/Model/SimplePublicObjectId.php index f16de7731..127295004 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php b/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php index ea7998ea1..19abb769c 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php index 74ad90fdd..5b120e8d4 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -288,9 +281,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['associations'] === null) { - $invalidProperties[] = "'associations' can't be null"; - } if ($this->container['properties'] === null) { $invalidProperties[] = "'properties' can't be null"; } @@ -312,7 +302,7 @@ public function valid() /** * Gets associations * - * @return \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[] + * @return \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null */ public function getAssociations() { @@ -322,7 +312,7 @@ public function getAssociations() /** * Sets associations * - * @param \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[] $associations associations + * @param \HubSpot\Client\Crm\Quotes\Model\PublicAssociationsForObject[]|null $associations associations * * @return self */ @@ -336,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php index 39bb32178..47219336d 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Quotes/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Quotes/Model/SimplePublicUpsertObject.php b/codegen/Crm/Quotes/Model/SimplePublicUpsertObject.php index 9859b5bf3..41bfeba0d 100644 --- a/codegen/Crm/Quotes/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Quotes/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Quotes/Model/StandardError.php b/codegen/Crm/Quotes/Model/StandardError.php index 813c74be4..d39e044b3 100644 --- a/codegen/Crm/Quotes/Model/StandardError.php +++ b/codegen/Crm/Quotes/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Quotes/Model/ValueWithTimestamp.php b/codegen/Crm/Quotes/Model/ValueWithTimestamp.php index b26ea7786..ab19474e0 100644 --- a/codegen/Crm/Quotes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Quotes/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Quotes/ObjectSerializer.php b/codegen/Crm/Quotes/ObjectSerializer.php index 421298251..d93b59f41 100644 --- a/codegen/Crm/Quotes/ObjectSerializer.php +++ b/codegen/Crm/Quotes/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Schemas/Api/CoreApi.php b/codegen/Crm/Schemas/Api/CoreApi.php index 8b85101d7..8d5c4f324 100644 --- a/codegen/Crm/Schemas/Api/CoreApi.php +++ b/codegen/Crm/Schemas/Api/CoreApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -101,13 +101,13 @@ class CoreApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -146,7 +146,7 @@ public function getConfig() * Delete a schema * * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Schemas\ApiException on non-2xx response or if the response body is not in the expected format @@ -164,7 +164,7 @@ public function archive($object_type, $archived = false, string $contentType = s * Delete a schema * * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Schemas\ApiException on non-2xx response or if the response body is not in the expected format @@ -197,18 +197,6 @@ public function archiveWithHttpInfo($object_type, $archived = false, string $con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -233,7 +221,7 @@ public function archiveWithHttpInfo($object_type, $archived = false, string $con * Delete a schema * * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -255,7 +243,7 @@ function ($response) { * Delete a schema * * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -293,7 +281,7 @@ function ($exception) { * Create request for operation 'archive' * * @param string $object_type Fully qualified name or object type ID of your schema. (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -453,18 +441,6 @@ public function archiveAssociationWithHttpInfo($object_type, $association_identi $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -713,18 +689,6 @@ public function createWithHttpInfo($object_schema_egg, string $contentType = sel $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -783,6 +747,19 @@ public function createWithHttpInfo($object_schema_egg, string $contentType = sel ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1060,18 +1037,6 @@ public function createAssociationWithHttpInfo($object_type, $association_definit $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -1130,6 +1095,19 @@ public function createAssociationWithHttpInfo($object_type, $association_definit ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Schemas\Model\AssociationDefinition'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1372,7 +1350,7 @@ public function createAssociationRequest($object_type, $association_definition_e * * Get all schemas * - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Schemas\ApiException on non-2xx response or if the response body is not in the expected format @@ -1390,7 +1368,7 @@ public function getAll($archived = false, string $contentType = self::contentTyp * * Get all schemas * - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Schemas\ApiException on non-2xx response or if the response body is not in the expected format @@ -1423,18 +1401,6 @@ public function getAllWithHttpInfo($archived = false, string $contentType = self $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1493,6 +1459,19 @@ public function getAllWithHttpInfo($archived = false, string $contentType = self ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Schemas\Model\CollectionResponseObjectSchemaNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1549,7 +1528,7 @@ public function getAllWithHttpInfo($archived = false, string $contentType = self * * Get all schemas * - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1570,7 +1549,7 @@ function ($response) { * * Get all schemas * - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1620,7 +1599,7 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1764,18 +1743,6 @@ public function getByIdWithHttpInfo($object_type, string $contentType = self::co $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1834,6 +1801,19 @@ public function getByIdWithHttpInfo($object_type, string $contentType = self::co ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Schemas\Model\ObjectSchema'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2112,18 +2092,6 @@ public function updateWithHttpInfo($object_type, $object_type_definition_patch, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2182,6 +2150,19 @@ public function updateWithHttpInfo($object_type, $object_type_definition_patch, ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Schemas\Model\ObjectTypeDefinition'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Schemas/ApiException.php b/codegen/Crm/Schemas/ApiException.php index f343948bf..b1c2a981a 100644 --- a/codegen/Crm/Schemas/ApiException.php +++ b/codegen/Crm/Schemas/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Schemas/Configuration.php b/codegen/Crm/Schemas/Configuration.php index 9af957467..6a2225971 100644 --- a/codegen/Crm/Schemas/Configuration.php +++ b/codegen/Crm/Schemas/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Schemas/HeaderSelector.php b/codegen/Crm/Schemas/HeaderSelector.php index 6521eafed..b3987dc9d 100644 --- a/codegen/Crm/Schemas/HeaderSelector.php +++ b/codegen/Crm/Schemas/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Schemas/Model/AssociationDefinition.php b/codegen/Crm/Schemas/Model/AssociationDefinition.php index de38b5b10..fda8f2746 100644 --- a/codegen/Crm/Schemas/Model/AssociationDefinition.php +++ b/codegen/Crm/Schemas/Model/AssociationDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('from_object_type_id', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/AssociationDefinitionEgg.php b/codegen/Crm/Schemas/Model/AssociationDefinitionEgg.php index 232a0ac3d..11a88c531 100644 --- a/codegen/Crm/Schemas/Model/AssociationDefinitionEgg.php +++ b/codegen/Crm/Schemas/Model/AssociationDefinitionEgg.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('from_object_type_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/CollectionResponseObjectSchemaNoPaging.php b/codegen/Crm/Schemas/Model/CollectionResponseObjectSchemaNoPaging.php index 4d89fafd7..f11d1244f 100644 --- a/codegen/Crm/Schemas/Model/CollectionResponseObjectSchemaNoPaging.php +++ b/codegen/Crm/Schemas/Model/CollectionResponseObjectSchemaNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Schemas/Model/Error.php b/codegen/Crm/Schemas/Model/Error.php index 9d436fe18..acf6bfe15 100644 --- a/codegen/Crm/Schemas/Model/Error.php +++ b/codegen/Crm/Schemas/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/ErrorDetail.php b/codegen/Crm/Schemas/Model/ErrorDetail.php index f1c49975e..3963a856d 100644 --- a/codegen/Crm/Schemas/Model/ErrorDetail.php +++ b/codegen/Crm/Schemas/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/ModelInterface.php b/codegen/Crm/Schemas/Model/ModelInterface.php index ce14a7088..3d06a78ae 100644 --- a/codegen/Crm/Schemas/Model/ModelInterface.php +++ b/codegen/Crm/Schemas/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Schemas/Model/ObjectSchema.php b/codegen/Crm/Schemas/Model/ObjectSchema.php index 13fdc0b5d..a23f57471 100644 --- a/codegen/Crm/Schemas/Model/ObjectSchema.php +++ b/codegen/Crm/Schemas/Model/ObjectSchema.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -336,10 +336,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('secondary_display_properties', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/ObjectSchemaEgg.php b/codegen/Crm/Schemas/Model/ObjectSchemaEgg.php index 4753a5089..4dd7ce821 100644 --- a/codegen/Crm/Schemas/Model/ObjectSchemaEgg.php +++ b/codegen/Crm/Schemas/Model/ObjectSchemaEgg.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('secondary_display_properties', $data ?? [], null); $this->setIfExists('required_properties', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/ObjectTypeDefinition.php b/codegen/Crm/Schemas/Model/ObjectTypeDefinition.php index cc482369e..84ffae67b 100644 --- a/codegen/Crm/Schemas/Model/ObjectTypeDefinition.php +++ b/codegen/Crm/Schemas/Model/ObjectTypeDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -318,10 +318,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('secondary_display_properties', $data ?? [], null); $this->setIfExists('object_type_id', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/ObjectTypeDefinitionLabels.php b/codegen/Crm/Schemas/Model/ObjectTypeDefinitionLabels.php index a603bb11a..1ed7a8a26 100644 --- a/codegen/Crm/Schemas/Model/ObjectTypeDefinitionLabels.php +++ b/codegen/Crm/Schemas/Model/ObjectTypeDefinitionLabels.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('plural', $data ?? [], null); $this->setIfExists('singular', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/ObjectTypeDefinitionPatch.php b/codegen/Crm/Schemas/Model/ObjectTypeDefinitionPatch.php index 7a1fde562..b4738f867 100644 --- a/codegen/Crm/Schemas/Model/ObjectTypeDefinitionPatch.php +++ b/codegen/Crm/Schemas/Model/ObjectTypeDefinitionPatch.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('secondary_display_properties', $data ?? [], null); $this->setIfExists('required_properties', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/ObjectTypePropertyCreate.php b/codegen/Crm/Schemas/Model/ObjectTypePropertyCreate.php index bd935ec81..6e9449294 100644 --- a/codegen/Crm/Schemas/Model/ObjectTypePropertyCreate.php +++ b/codegen/Crm/Schemas/Model/ObjectTypePropertyCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -424,10 +424,10 @@ public function getNumberDisplayHintAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('option_sort_strategy', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/Option.php b/codegen/Crm/Schemas/Model/Option.php index ae1608b70..d85226609 100644 --- a/codegen/Crm/Schemas/Model/Option.php +++ b/codegen/Crm/Schemas/Model/Option.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/OptionInput.php b/codegen/Crm/Schemas/Model/OptionInput.php index f69041526..440fe717e 100644 --- a/codegen/Crm/Schemas/Model/OptionInput.php +++ b/codegen/Crm/Schemas/Model/OptionInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/Property.php b/codegen/Crm/Schemas/Model/Property.php index 68a24764a..22bc21cb7 100644 --- a/codegen/Crm/Schemas/Model/Property.php +++ b/codegen/Crm/Schemas/Model/Property.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -407,10 +407,10 @@ public function getDataSensitivityAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); diff --git a/codegen/Crm/Schemas/Model/PropertyModificationMetadata.php b/codegen/Crm/Schemas/Model/PropertyModificationMetadata.php index ac8224856..5e89c506f 100644 --- a/codegen/Crm/Schemas/Model/PropertyModificationMetadata.php +++ b/codegen/Crm/Schemas/Model/PropertyModificationMetadata.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('read_only_options', $data ?? [], null); $this->setIfExists('read_only_value', $data ?? [], null); diff --git a/codegen/Crm/Schemas/ObjectSerializer.php b/codegen/Crm/Schemas/ObjectSerializer.php index 6363af038..5f8fccbb8 100644 --- a/codegen/Crm/Schemas/ObjectSerializer.php +++ b/codegen/Crm/Schemas/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Tickets/Api/BasicApi.php b/codegen/Crm/Tickets/Api/BasicApi.php index e4c2b8b70..bfb680509 100644 --- a/codegen/Crm/Tickets/Api/BasicApi.php +++ b/codegen/Crm/Tickets/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,6 +83,9 @@ class BasicApi 'getPage' => [ 'application/json', ], + 'merge' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -95,13 +98,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -139,7 +142,7 @@ public function getConfig() * * Archive * - * @param string $ticket_id ticket_id (required) + * @param string $ticket_id The ID of the ticket to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -156,7 +159,7 @@ public function archive($ticket_id, string $contentType = self::contentTypes['ar * * Archive * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -189,18 +192,6 @@ public function archiveWithHttpInfo($ticket_id, string $contentType = self::cont $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -224,7 +215,7 @@ public function archiveWithHttpInfo($ticket_id, string $contentType = self::cont * * Archive * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -245,7 +236,7 @@ function ($response) { * * Archive * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -282,7 +273,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -431,18 +422,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +480,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -725,12 +717,12 @@ public function createRequest($simple_public_object_input_for_create, string $co * * Read * - * @param string $ticket_id ticket_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $ticket_id The ID of the ticket. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -748,12 +740,12 @@ public function getById($ticket_id, $properties = null, $properties_with_history * * Read * - * @param string $ticket_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $ticket_id The ID of the ticket. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +778,6 @@ public function getByIdWithHttpInfo($ticket_id, $properties = null, $properties_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -856,6 +836,19 @@ public function getByIdWithHttpInfo($ticket_id, $properties = null, $properties_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -912,12 +905,12 @@ public function getByIdWithHttpInfo($ticket_id, $properties = null, $properties_ * * Read * - * @param string $ticket_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $ticket_id The ID of the ticket. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -938,12 +931,12 @@ function ($response) { * * Read * - * @param string $ticket_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $ticket_id The ID of the ticket. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,12 +986,12 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $ticket_id (required) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $ticket_id The ID of the ticket. (required) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1139,12 @@ public function getByIdRequest($ticket_id, $properties = null, $properties_with_ * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1162,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1200,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1258,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1327,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1353,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1408,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string[] $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) - * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) + * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) + * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1557,6 +1551,352 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ ); } + /** + * Operation merge + * + * Merge two tickets + * + * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\Error + */ + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); + return $response; + } + + /** + * Operation mergeWithHttpInfo + * + * Merge two tickets + * + * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $request = $this->mergeRequest($public_merge_input, $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: + if ('\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject' !== '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\Tickets\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Tickets\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Tickets\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\Tickets\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Tickets\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two tickets + * + * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two tickets + * + * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input, $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 'merge' + * + * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + + $resourcePath = '/crm/v3/objects/tickets/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation update * @@ -1564,7 +1904,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $ticket_id ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1924,7 @@ public function update($ticket_id, $simple_public_object_input, $id_property = n * * @param string $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1957,6 @@ public function updateWithHttpInfo($ticket_id, $simple_public_object_input, $id_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1687,6 +2015,19 @@ public function updateWithHttpInfo($ticket_id, $simple_public_object_input, $id_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +2086,7 @@ public function updateWithHttpInfo($ticket_id, $simple_public_object_input, $id_ * * @param string $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1768,7 +2109,7 @@ function ($response) { * * @param string $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1820,7 +2161,7 @@ function ($exception) { * * @param string $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Crm/Tickets/Api/BatchApi.php b/codegen/Crm/Tickets/Api/BatchApi.php index 7df5f9c2d..144aca4a2 100644 --- a/codegen/Crm/Tickets/Api/BatchApi.php +++ b/codegen/Crm/Tickets/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Tickets\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Tickets\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Tickets\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Tickets/Api/MergeApi.php b/codegen/Crm/Tickets/Api/MergeApi.php deleted file mode 100644 index beaa5018f..000000000 --- a/codegen/Crm/Tickets/Api/MergeApi.php +++ /dev/null @@ -1,488 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation merge - * - * Merge two tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\Error - */ - public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); - return $response; - } - - /** - * Operation mergeWithHttpInfo - * - * Merge two tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Tickets\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $request = $this->mergeRequest($public_merge_input, $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(); - - 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() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject' !== '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\Tickets\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Tickets\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Tickets\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\Tickets\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Tickets\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeAsyncWithHttpInfo - * - * Merge two tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $returnType = '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input, $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 'merge' - * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - - // verify the required parameter 'public_merge_input' is set - if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_merge_input when calling merge' - ); - } - - - $resourcePath = '/crm/v3/objects/tickets/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_merge_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); - } else { - $httpBody = $public_merge_input; - } - } elseif (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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Tickets/Api/SearchApi.php b/codegen/Crm/Tickets/Api/SearchApi.php index e8ec3350a..52816d05b 100644 --- a/codegen/Crm/Tickets/Api/SearchApi.php +++ b/codegen/Crm/Tickets/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for tickets + * * @param \HubSpot\Client\Crm\Tickets\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for tickets + * * @param \HubSpot\Client\Crm\Tickets\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Tickets\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for tickets + * * @param \HubSpot\Client\Crm\Tickets\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for tickets + * * @param \HubSpot\Client\Crm\Tickets\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 * diff --git a/codegen/Crm/Tickets/ApiException.php b/codegen/Crm/Tickets/ApiException.php index 763017f36..4bca973c5 100644 --- a/codegen/Crm/Tickets/ApiException.php +++ b/codegen/Crm/Tickets/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Tickets/Configuration.php b/codegen/Crm/Tickets/Configuration.php index 3dff23171..82654dd88 100644 --- a/codegen/Crm/Tickets/Configuration.php +++ b/codegen/Crm/Tickets/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Tickets/HeaderSelector.php b/codegen/Crm/Tickets/HeaderSelector.php index 99d272983..dc21001ad 100644 --- a/codegen/Crm/Tickets/HeaderSelector.php +++ b/codegen/Crm/Tickets/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Tickets/Model/AssociatedId.php b/codegen/Crm/Tickets/Model/AssociatedId.php index f9ff8cbdb..9e28bade1 100644 --- a/codegen/Crm/Tickets/Model/AssociatedId.php +++ b/codegen/Crm/Tickets/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/AssociationSpec.php b/codegen/Crm/Tickets/Model/AssociationSpec.php index eb0290e20..45f247d98 100644 --- a/codegen/Crm/Tickets/Model/AssociationSpec.php +++ b/codegen/Crm/Tickets/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); @@ -298,6 +298,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -307,6 +310,9 @@ public function listInvalidProperties() ); } + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } return $invalidProperties; } @@ -325,7 +331,7 @@ public function valid() /** * Gets association_category * - * @return string|null + * @return string */ public function getAssociationCategory() { @@ -335,7 +341,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string|null $association_category association_category + * @param string $association_category association_category * * @return self */ @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int|null + * @return int */ public function getAssociationTypeId() { @@ -372,7 +378,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int|null $association_type_id association_type_id + * @param int $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInput.php index e85031332..2120c2ab4 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 5cdb06941..d2a36a15d 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 4275c4974..cdc4960a3 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectId.php index 6d4410422..f66343ac1 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php index 926bc13ff..c534a9892 100644 --- a/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php index 8e67df2d8..c4f91572d 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObjectWithErrors.php index 593ee1c9a..5678eaed5 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php index fd8502e5a..75b541672 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 4ac93f3f7..100338bd5 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Tickets/Model/CollectionResponseAssociatedId.php index 6a3489ecd..3afbd8eac 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Tickets/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 9248790bb..8c41ca85f 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 0e78609fd..ae673a7e7 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/Error.php b/codegen/Crm/Tickets/Model/Error.php index 1def01ada..9808eb5c3 100644 --- a/codegen/Crm/Tickets/Model/Error.php +++ b/codegen/Crm/Tickets/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/ErrorDetail.php b/codegen/Crm/Tickets/Model/ErrorDetail.php index 051532703..129cde373 100644 --- a/codegen/Crm/Tickets/Model/ErrorDetail.php +++ b/codegen/Crm/Tickets/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/Filter.php b/codegen/Crm/Tickets/Model/Filter.php index 9e3b56e5a..56425dd6c 100644 --- a/codegen/Crm/Tickets/Model/Filter.php +++ b/codegen/Crm/Tickets/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/FilterGroup.php b/codegen/Crm/Tickets/Model/FilterGroup.php index 01a35ff27..ae7b77db2 100644 --- a/codegen/Crm/Tickets/Model/FilterGroup.php +++ b/codegen/Crm/Tickets/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Tickets/Model/ForwardPaging.php b/codegen/Crm/Tickets/Model/ForwardPaging.php index 543e581ba..885d979a7 100644 --- a/codegen/Crm/Tickets/Model/ForwardPaging.php +++ b/codegen/Crm/Tickets/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Tickets/Model/ModelInterface.php b/codegen/Crm/Tickets/Model/ModelInterface.php index 833116387..ffbf58994 100644 --- a/codegen/Crm/Tickets/Model/ModelInterface.php +++ b/codegen/Crm/Tickets/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Tickets/Model/NextPage.php b/codegen/Crm/Tickets/Model/NextPage.php index bcb4233a2..1e19b2e08 100644 --- a/codegen/Crm/Tickets/Model/NextPage.php +++ b/codegen/Crm/Tickets/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/Paging.php b/codegen/Crm/Tickets/Model/Paging.php index a9cb3aa6b..e45b2a1d4 100644 --- a/codegen/Crm/Tickets/Model/Paging.php +++ b/codegen/Crm/Tickets/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/PreviousPage.php b/codegen/Crm/Tickets/Model/PreviousPage.php index 405402c12..1ce1d8053 100644 --- a/codegen/Crm/Tickets/Model/PreviousPage.php +++ b/codegen/Crm/Tickets/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/PublicAssociationsForObject.php b/codegen/Crm/Tickets/Model/PublicAssociationsForObject.php index 8e79f8e54..9def38647 100644 --- a/codegen/Crm/Tickets/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Tickets/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); @@ -281,6 +281,12 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } return $invalidProperties; } @@ -299,7 +305,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Tickets\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Tickets\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Tickets\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Tickets/Model/PublicMergeInput.php b/codegen/Crm/Tickets/Model/PublicMergeInput.php index 3cf573d3f..f85495785 100644 --- a/codegen/Crm/Tickets/Model/PublicMergeInput.php +++ b/codegen/Crm/Tickets/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_id_to_merge', $data ?? [], null); $this->setIfExists('primary_object_id', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/PublicObjectId.php b/codegen/Crm/Tickets/Model/PublicObjectId.php index 661d07c56..3dd1066a6 100644 --- a/codegen/Crm/Tickets/Model/PublicObjectId.php +++ b/codegen/Crm/Tickets/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } @@ -274,6 +274,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } return $invalidProperties; } @@ -292,7 +295,7 @@ public function valid() /** * Gets id * - * @return string|null + * @return string */ public function getId() { @@ -302,7 +305,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string $id id * * @return self */ diff --git a/codegen/Crm/Tickets/Model/PublicObjectSearchRequest.php b/codegen/Crm/Tickets/Model/PublicObjectSearchRequest.php index 072e6265e..8fb36a3ae 100644 --- a/codegen/Crm/Tickets/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Tickets/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/SimplePublicObject.php b/codegen/Crm/Tickets/Model/SimplePublicObject.php index b5c5e8060..51b8c186a 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObject.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInput.php index fddd449cb..0c9a95c05 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..01514cfba --- /dev/null +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets associations + * + * @return \HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputUpsert.php index 1562434b5..06f232f57 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectId.php b/codegen/Crm/Tickets/Model/SimplePublicObjectId.php index 76a5772b5..b7d1e0657 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php b/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php index 59a7df66f..36e533ad3 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php index da8f6e6e2..a0987b342 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Tickets\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -333,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php index dc81abd10..08edc827e 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Tickets/Model/SimplePublicUpsertObject.php b/codegen/Crm/Tickets/Model/SimplePublicUpsertObject.php index 7244e852f..7c4e42a4a 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Tickets/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Tickets/Model/StandardError.php b/codegen/Crm/Tickets/Model/StandardError.php index 45b4b2693..4402ed411 100644 --- a/codegen/Crm/Tickets/Model/StandardError.php +++ b/codegen/Crm/Tickets/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Tickets/Model/ValueWithTimestamp.php b/codegen/Crm/Tickets/Model/ValueWithTimestamp.php index a61b8c614..518d59ac8 100644 --- a/codegen/Crm/Tickets/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Tickets/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Tickets/ObjectSerializer.php b/codegen/Crm/Tickets/ObjectSerializer.php index 19e92baea..b84d3e8fa 100644 --- a/codegen/Crm/Tickets/ObjectSerializer.php +++ b/codegen/Crm/Tickets/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Timeline/Api/EventsApi.php b/codegen/Crm/Timeline/Api/EventsApi.php index 7c0988137..36e716c8f 100644 --- a/codegen/Crm/Timeline/Api/EventsApi.php +++ b/codegen/Crm/Timeline/Api/EventsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class EventsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -190,18 +190,6 @@ public function createWithHttpInfo($timeline_event, string $contentType = self:: $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -260,6 +248,19 @@ public function createWithHttpInfo($timeline_event, string $contentType = self:: ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -534,18 +535,6 @@ public function createBatchWithHttpInfo($batch_input_timeline_event, string $con $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -793,18 +782,6 @@ public function getByIdWithHttpInfo($event_template_id, $event_id, string $conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -863,6 +840,19 @@ public function getByIdWithHttpInfo($event_template_id, $event_id, string $conte ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1159,18 +1149,6 @@ public function getDetailByIdWithHttpInfo($event_template_id, $event_id, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1229,6 +1207,19 @@ public function getDetailByIdWithHttpInfo($event_template_id, $event_id, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\EventDetail'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1474,7 +1465,7 @@ public function getDetailByIdRequest($event_template_id, $event_id, string $cont * * @param string $event_template_id The event template ID. (required) * @param string $event_id The event ID. (required) - * @param bool $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional) + * @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 @@ -1494,7 +1485,7 @@ public function getRenderById($event_template_id, $event_id, $detail = null, str * * @param string $event_template_id The event template ID. (required) * @param string $event_id The event ID. (required) - * @param bool $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional) + * @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 @@ -1527,18 +1518,6 @@ public function getRenderByIdWithHttpInfo($event_template_id, $event_id, $detail $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1597,6 +1576,19 @@ public function getRenderByIdWithHttpInfo($event_template_id, $event_id, $detail ]; } + 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() + ); + } + $returnType = 'string'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1655,7 +1647,7 @@ public function getRenderByIdWithHttpInfo($event_template_id, $event_id, $detail * * @param string $event_template_id The event template ID. (required) * @param string $event_id The event ID. (required) - * @param bool $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional) + * @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 \InvalidArgumentException @@ -1678,7 +1670,7 @@ function ($response) { * * @param string $event_template_id The event template ID. (required) * @param string $event_id The event ID. (required) - * @param bool $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional) + * @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 \InvalidArgumentException @@ -1730,7 +1722,7 @@ function ($exception) { * * @param string $event_template_id The event template ID. (required) * @param string $event_id The event ID. (required) - * @param bool $detail Set to 'true', we want to render the `detailTemplate` instead of the `headerTemplate`. (optional) + * @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 \InvalidArgumentException diff --git a/codegen/Crm/Timeline/Api/TemplatesApi.php b/codegen/Crm/Timeline/Api/TemplatesApi.php index d547f1886..51d3d8eb8 100644 --- a/codegen/Crm/Timeline/Api/TemplatesApi.php +++ b/codegen/Crm/Timeline/Api/TemplatesApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class TemplatesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -191,18 +191,6 @@ public function archiveWithHttpInfo($event_template_id, $app_id, string $content $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -454,18 +442,6 @@ public function createWithHttpInfo($app_id, $timeline_event_template_create_requ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -524,6 +500,19 @@ public function createWithHttpInfo($app_id, $timeline_event_template_create_requ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -818,18 +807,6 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -888,6 +865,19 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\CollectionResponseTimelineEventTemplateNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1167,18 +1157,6 @@ public function getByIdWithHttpInfo($event_template_id, $app_id, string $content $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1237,6 +1215,19 @@ public function getByIdWithHttpInfo($event_template_id, $app_id, string $content ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1536,18 +1527,6 @@ public function updateWithHttpInfo($event_template_id, $app_id, $timeline_event_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1606,6 +1585,19 @@ public function updateWithHttpInfo($event_template_id, $app_id, $timeline_event_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplate'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Timeline/Api/TokensApi.php b/codegen/Crm/Timeline/Api/TokensApi.php index 9bd20c38b..5afc22644 100644 --- a/codegen/Crm/Timeline/Api/TokensApi.php +++ b/codegen/Crm/Timeline/Api/TokensApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -89,13 +89,13 @@ class TokensApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -187,18 +187,6 @@ public function archiveWithHttpInfo($event_template_id, $token_name, $app_id, st $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -470,18 +458,6 @@ public function createWithHttpInfo($event_template_id, $app_id, $timeline_event_ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -540,6 +516,19 @@ public function createWithHttpInfo($event_template_id, $app_id, $timeline_event_ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -858,18 +847,6 @@ public function updateWithHttpInfo($event_template_id, $token_name, $app_id, $ti $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -928,6 +905,19 @@ public function updateWithHttpInfo($event_template_id, $token_name, $app_id, $ti ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Crm\Timeline\Model\TimelineEventTemplateToken'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Timeline/ApiException.php b/codegen/Crm/Timeline/ApiException.php index b7eac4aa2..25f054f9e 100644 --- a/codegen/Crm/Timeline/ApiException.php +++ b/codegen/Crm/Timeline/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Timeline/Configuration.php b/codegen/Crm/Timeline/Configuration.php index 539fcf3c1..eeff6dac1 100644 --- a/codegen/Crm/Timeline/Configuration.php +++ b/codegen/Crm/Timeline/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Timeline/HeaderSelector.php b/codegen/Crm/Timeline/HeaderSelector.php index 25f402343..a0928e646 100644 --- a/codegen/Crm/Timeline/HeaderSelector.php +++ b/codegen/Crm/Timeline/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Timeline/Model/BatchInputTimelineEvent.php b/codegen/Crm/Timeline/Model/BatchInputTimelineEvent.php index 7d5d3b54e..a5f5f48b8 100644 --- a/codegen/Crm/Timeline/Model/BatchInputTimelineEvent.php +++ b/codegen/Crm/Timeline/Model/BatchInputTimelineEvent.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponse.php b/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponse.php index 4c656ce5d..9a26c5450 100644 --- a/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponse.php +++ b/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -289,10 +289,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponseWithErrors.php b/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponseWithErrors.php index c6a9327b1..1b26a1f4c 100644 --- a/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponseWithErrors.php +++ b/codegen/Crm/Timeline/Model/BatchResponseTimelineEventResponseWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/CollectionResponseTimelineEventTemplateNoPaging.php b/codegen/Crm/Timeline/Model/CollectionResponseTimelineEventTemplateNoPaging.php index 14ebd3538..d383155a8 100644 --- a/codegen/Crm/Timeline/Model/CollectionResponseTimelineEventTemplateNoPaging.php +++ b/codegen/Crm/Timeline/Model/CollectionResponseTimelineEventTemplateNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Crm/Timeline/Model/Error.php b/codegen/Crm/Timeline/Model/Error.php index cbda8f1a7..2ff7992aa 100644 --- a/codegen/Crm/Timeline/Model/Error.php +++ b/codegen/Crm/Timeline/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/ErrorDetail.php b/codegen/Crm/Timeline/Model/ErrorDetail.php index a7c3ba199..315e1a10d 100644 --- a/codegen/Crm/Timeline/Model/ErrorDetail.php +++ b/codegen/Crm/Timeline/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/EventDetail.php b/codegen/Crm/Timeline/Model/EventDetail.php index db2f07ad4..bda490f3e 100644 --- a/codegen/Crm/Timeline/Model/EventDetail.php +++ b/codegen/Crm/Timeline/Model/EventDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('details', $data ?? [], null); } diff --git a/codegen/Crm/Timeline/Model/ModelInterface.php b/codegen/Crm/Timeline/Model/ModelInterface.php index efed43a08..2493c8d7b 100644 --- a/codegen/Crm/Timeline/Model/ModelInterface.php +++ b/codegen/Crm/Timeline/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Timeline/Model/StandardError.php b/codegen/Crm/Timeline/Model/StandardError.php index 014d09b30..4d7df4752 100644 --- a/codegen/Crm/Timeline/Model/StandardError.php +++ b/codegen/Crm/Timeline/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEvent.php b/codegen/Crm/Timeline/Model/TimelineEvent.php index 235df1adc..58150d689 100644 --- a/codegen/Crm/Timeline/Model/TimelineEvent.php +++ b/codegen/Crm/Timeline/Model/TimelineEvent.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -294,10 +294,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_template_id', $data ?? [], null); $this->setIfExists('extra_data', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventIFrame.php b/codegen/Crm/Timeline/Model/TimelineEventIFrame.php index 9ec36779a..63fcdb054 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventIFrame.php +++ b/codegen/Crm/Timeline/Model/TimelineEventIFrame.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link_label', $data ?? [], null); $this->setIfExists('header_label', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventResponse.php b/codegen/Crm/Timeline/Model/TimelineEventResponse.php index 18673d66d..ae63225f9 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventResponse.php +++ b/codegen/Crm/Timeline/Model/TimelineEventResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -306,10 +306,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_template_id', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventTemplate.php b/codegen/Crm/Timeline/Model/TimelineEventTemplate.php index d12368abc..61a48ba98 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventTemplate.php +++ b/codegen/Crm/Timeline/Model/TimelineEventTemplate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -282,10 +282,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('detail_template', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventTemplateCreateRequest.php b/codegen/Crm/Timeline/Model/TimelineEventTemplateCreateRequest.php index f1272352e..6262807ae 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventTemplateCreateRequest.php +++ b/codegen/Crm/Timeline/Model/TimelineEventTemplateCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('detail_template', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventTemplateToken.php b/codegen/Crm/Timeline/Model/TimelineEventTemplateToken.php index fdc96257f..08f59cc1c 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventTemplateToken.php +++ b/codegen/Crm/Timeline/Model/TimelineEventTemplateToken.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -295,10 +295,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('options', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenOption.php b/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenOption.php index fc19842f2..a11be5936 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenOption.php +++ b/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenOption.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('label', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenUpdateRequest.php b/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenUpdateRequest.php index ae19366f0..4dab70c1c 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenUpdateRequest.php +++ b/codegen/Crm/Timeline/Model/TimelineEventTemplateTokenUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('options', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); diff --git a/codegen/Crm/Timeline/Model/TimelineEventTemplateUpdateRequest.php b/codegen/Crm/Timeline/Model/TimelineEventTemplateUpdateRequest.php index d807c71fd..45e405c2a 100644 --- a/codegen/Crm/Timeline/Model/TimelineEventTemplateUpdateRequest.php +++ b/codegen/Crm/Timeline/Model/TimelineEventTemplateUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('detail_template', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Crm/Timeline/ObjectSerializer.php b/codegen/Crm/Timeline/ObjectSerializer.php index bfda68aef..48cfc164f 100644 --- a/codegen/Crm/Timeline/ObjectSerializer.php +++ b/codegen/Crm/Timeline/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Events/Api/EventsApi.php b/codegen/Events/Api/EventsApi.php index 65b806758..bca8c288d 100644 --- a/codegen/Events/Api/EventsApi.php +++ b/codegen/Events/Api/EventsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class EventsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -128,20 +128,20 @@ public function getConfig() /** * Operation getPage * - * Event Instance Query + * Retrieve event data * - * @param string $object_type The CRM Object type name to filter event instances on. Optionally, you can also provide an objectId in another param to filter to a specific CRM Object instance. (optional) - * @param string $event_type The event type name. A list of available event type names can be obtained from another API call. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before before (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string[] $sort Sort direction based on the timestamp of the event instance, ASCENDING or DESCENDING. (optional) - * @param \DateTime $occurred_after occurred_after (optional) - * @param \DateTime $occurred_before occurred_before (optional) - * @param int $object_id The ID of the CRM Object to filter event instances on. If filtering on objectId, you must also provide an objectType. (optional) - * @param object $object_property_propname object_property_propname (optional) - * @param object $property_propname property_propname (optional) - * @param string[] $id ID of an event instance. IDs are 1:1 with event instances. If you. provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) + * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) + * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) + * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) + * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) + * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) + * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) + * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -157,20 +157,20 @@ public function getPage($object_type = null, $event_type = null, $after = null, /** * Operation getPageWithHttpInfo * - * Event Instance Query + * Retrieve event data * - * @param string $object_type The CRM Object type name to filter event instances on. Optionally, you can also provide an objectId in another param to filter to a specific CRM Object instance. (optional) - * @param string $event_type The event type name. A list of available event type names can be obtained from another API call. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string[] $sort Sort direction based on the timestamp of the event instance, ASCENDING or DESCENDING. (optional) - * @param \DateTime $occurred_after (optional) - * @param \DateTime $occurred_before (optional) - * @param int $object_id The ID of the CRM Object to filter event instances on. If filtering on objectId, you must also provide an objectType. (optional) - * @param object $object_property_propname (optional) - * @param object $property_propname (optional) - * @param string[] $id ID of an event instance. IDs are 1:1 with event instances. If you. provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) + * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) + * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) + * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) + * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) + * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) + * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) + * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -203,18 +203,6 @@ public function getPageWithHttpInfo($object_type = null, $event_type = null, $af $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -273,6 +261,19 @@ public function getPageWithHttpInfo($object_type = null, $event_type = null, $af ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -327,20 +328,20 @@ public function getPageWithHttpInfo($object_type = null, $event_type = null, $af /** * Operation getPageAsync * - * Event Instance Query + * Retrieve event data * - * @param string $object_type The CRM Object type name to filter event instances on. Optionally, you can also provide an objectId in another param to filter to a specific CRM Object instance. (optional) - * @param string $event_type The event type name. A list of available event type names can be obtained from another API call. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string[] $sort Sort direction based on the timestamp of the event instance, ASCENDING or DESCENDING. (optional) - * @param \DateTime $occurred_after (optional) - * @param \DateTime $occurred_before (optional) - * @param int $object_id The ID of the CRM Object to filter event instances on. If filtering on objectId, you must also provide an objectType. (optional) - * @param object $object_property_propname (optional) - * @param object $property_propname (optional) - * @param string[] $id ID of an event instance. IDs are 1:1 with event instances. If you. provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) + * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) + * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) + * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) + * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) + * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) + * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) + * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -359,20 +360,20 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * Event Instance Query + * Retrieve event data * - * @param string $object_type The CRM Object type name to filter event instances on. Optionally, you can also provide an objectId in another param to filter to a specific CRM Object instance. (optional) - * @param string $event_type The event type name. A list of available event type names can be obtained from another API call. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string[] $sort Sort direction based on the timestamp of the event instance, ASCENDING or DESCENDING. (optional) - * @param \DateTime $occurred_after (optional) - * @param \DateTime $occurred_before (optional) - * @param int $object_id The ID of the CRM Object to filter event instances on. If filtering on objectId, you must also provide an objectType. (optional) - * @param object $object_property_propname (optional) - * @param object $property_propname (optional) - * @param string[] $id ID of an event instance. IDs are 1:1 with event instances. If you. provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) + * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) + * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) + * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) + * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) + * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) + * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) + * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -422,18 +423,18 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $object_type The CRM Object type name to filter event instances on. Optionally, you can also provide an objectId in another param to filter to a specific CRM Object instance. (optional) - * @param string $event_type The event type name. A list of available event type names can be obtained from another API call. (optional) - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string $before (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param string[] $sort Sort direction based on the timestamp of the event instance, ASCENDING or DESCENDING. (optional) - * @param \DateTime $occurred_after (optional) - * @param \DateTime $occurred_before (optional) - * @param int $object_id The ID of the CRM Object to filter event instances on. If filtering on objectId, you must also provide an objectType. (optional) - * @param object $object_property_propname (optional) - * @param object $property_propname (optional) - * @param string[] $id ID of an event instance. IDs are 1:1 with event instances. If you. provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) + * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param string|null $before (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) + * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) + * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) + * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) + * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) + * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) + * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -685,18 +686,6 @@ public function getTypesWithHttpInfo(string $contentType = self::contentTypes['g $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -755,6 +744,19 @@ public function getTypesWithHttpInfo(string $contentType = self::contentTypes['g ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Events/ApiException.php b/codegen/Events/ApiException.php index b56a76c9c..8c33b1876 100644 --- a/codegen/Events/ApiException.php +++ b/codegen/Events/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Events/Configuration.php b/codegen/Events/Configuration.php index 4a3add48b..c0feffb09 100644 --- a/codegen/Events/Configuration.php +++ b/codegen/Events/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Events/HeaderSelector.php b/codegen/Events/HeaderSelector.php index 5e235ccca..5ecdd7e23 100644 --- a/codegen/Events/HeaderSelector.php +++ b/codegen/Events/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Events/Model/CollectionResponseExternalUnifiedEvent.php b/codegen/Events/Model/CollectionResponseExternalUnifiedEvent.php index db71a36b6..7a27dccc2 100644 --- a/codegen/Events/Model/CollectionResponseExternalUnifiedEvent.php +++ b/codegen/Events/Model/CollectionResponseExternalUnifiedEvent.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Events/Model/Error.php b/codegen/Events/Model/Error.php index 831450082..897753cec 100644 --- a/codegen/Events/Model/Error.php +++ b/codegen/Events/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Events/Model/ErrorDetail.php b/codegen/Events/Model/ErrorDetail.php index 8fa88d454..1ece8c463 100644 --- a/codegen/Events/Model/ErrorDetail.php +++ b/codegen/Events/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Events/Model/ExternalUnifiedEvent.php b/codegen/Events/Model/ExternalUnifiedEvent.php index af6bef09d..44f0e022a 100644 --- a/codegen/Events/Model/ExternalUnifiedEvent.php +++ b/codegen/Events/Model/ExternalUnifiedEvent.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('occurred_at', $data ?? [], null); $this->setIfExists('event_type', $data ?? [], null); diff --git a/codegen/Events/Model/ModelInterface.php b/codegen/Events/Model/ModelInterface.php index 61bd97609..956030e8c 100644 --- a/codegen/Events/Model/ModelInterface.php +++ b/codegen/Events/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Events/Model/NextPage.php b/codegen/Events/Model/NextPage.php index d6d4e1677..cb6fef516 100644 --- a/codegen/Events/Model/NextPage.php +++ b/codegen/Events/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Events/Model/Paging.php b/codegen/Events/Model/Paging.php index dfc89528d..0b7817ad5 100644 --- a/codegen/Events/Model/Paging.php +++ b/codegen/Events/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Events/Model/PreviousPage.php b/codegen/Events/Model/PreviousPage.php index 498d11195..a74f0dbb5 100644 --- a/codegen/Events/Model/PreviousPage.php +++ b/codegen/Events/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Events/Model/VisibleExternalEventTypeNames.php b/codegen/Events/Model/VisibleExternalEventTypeNames.php index 969221b04..3a8c20dc8 100644 --- a/codegen/Events/Model/VisibleExternalEventTypeNames.php +++ b/codegen/Events/Model/VisibleExternalEventTypeNames.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_types', $data ?? [], null); } diff --git a/codegen/Events/ObjectSerializer.php b/codegen/Events/ObjectSerializer.php index 59dfe9f47..000cf5ee1 100644 --- a/codegen/Events/ObjectSerializer.php +++ b/codegen/Events/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Events/Send/Api/CustomEventDataApi.php b/codegen/Events/Send/Api/BasicApi.php similarity index 93% rename from codegen/Events/Send/Api/CustomEventDataApi.php rename to codegen/Events/Send/Api/BasicApi.php index 984c96ac8..d5ee60a86 100644 --- a/codegen/Events/Send/Api/CustomEventDataApi.php +++ b/codegen/Events/Send/Api/BasicApi.php @@ -1,6 +1,6 @@ client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,7 +125,7 @@ public function getConfig() /** * Operation send * - * Send custom event completion + * Send a custom event completion * * @param \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest $behavioral_event_http_completion_request behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation @@ -142,7 +142,7 @@ public function send($behavioral_event_http_completion_request, string $contentT /** * Operation sendWithHttpInfo * - * Send custom event completion + * Send a custom event completion * * @param \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest $behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation @@ -177,18 +177,6 @@ public function sendWithHttpInfo($behavioral_event_http_completion_request, stri $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -210,7 +198,7 @@ public function sendWithHttpInfo($behavioral_event_http_completion_request, stri /** * Operation sendAsync * - * Send custom event completion + * Send a custom event completion * * @param \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest $behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation @@ -231,7 +219,7 @@ function ($response) { /** * Operation sendAsyncWithHttpInfo * - * Send custom event completion + * Send a custom event completion * * @param \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest $behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation diff --git a/codegen/Crm/Contacts/Api/GDPRApi.php b/codegen/Events/Send/Api/BatchApi.php similarity index 66% rename from codegen/Crm/Contacts/Api/GDPRApi.php rename to codegen/Events/Send/Api/BatchApi.php index bfba65a12..321f6e887 100644 --- a/codegen/Crm/Contacts/Api/GDPRApi.php +++ b/codegen/Events/Send/Api/BatchApi.php @@ -1,22 +1,22 @@ [ + 'send' => [ 'application/json', ], ]; @@ -83,13 +83,13 @@ class GDPRApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -123,37 +123,37 @@ public function getConfig() } /** - * Operation purge + * Operation send * - * GDPR DELETE + * Send a batch of event completions * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * @param \HubSpot\Client\Events\Send\Model\BatchedBehavioralEventHttpCompletionRequest $batched_behavioral_event_http_completion_request batched_behavioral_event_http_completion_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \HubSpot\Client\Events\Send\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + public function send($batched_behavioral_event_http_completion_request, string $contentType = self::contentTypes['send'][0]) { - $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); + $this->sendWithHttpInfo($batched_behavioral_event_http_completion_request, $contentType); } /** - * Operation purgeWithHttpInfo + * Operation sendWithHttpInfo * - * GDPR DELETE + * Send a batch of event completions * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * @param \HubSpot\Client\Events\Send\Model\BatchedBehavioralEventHttpCompletionRequest $batched_behavioral_event_http_completion_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \HubSpot\Client\Events\Send\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + public function sendWithHttpInfo($batched_behavioral_event_http_completion_request, string $contentType = self::contentTypes['send'][0]) { - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); + $request = $this->sendRequest($batched_behavioral_event_http_completion_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -177,18 +177,6 @@ public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -197,7 +185,7 @@ public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\Error', + '\HubSpot\Client\Events\Send\Model\Error', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -208,19 +196,19 @@ public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType } /** - * Operation purgeAsync + * Operation sendAsync * - * GDPR DELETE + * Send a batch of event completions * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * @param \HubSpot\Client\Events\Send\Model\BatchedBehavioralEventHttpCompletionRequest $batched_behavioral_event_http_completion_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + public function sendAsync($batched_behavioral_event_http_completion_request, string $contentType = self::contentTypes['send'][0]) { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) + return $this->sendAsyncWithHttpInfo($batched_behavioral_event_http_completion_request, $contentType) ->then( function ($response) { return $response[0]; @@ -229,20 +217,20 @@ function ($response) { } /** - * Operation purgeAsyncWithHttpInfo + * Operation sendAsyncWithHttpInfo * - * GDPR DELETE + * Send a batch of event completions * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * @param \HubSpot\Client\Events\Send\Model\BatchedBehavioralEventHttpCompletionRequest $batched_behavioral_event_http_completion_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + public function sendAsyncWithHttpInfo($batched_behavioral_event_http_completion_request, string $contentType = self::contentTypes['send'][0]) { $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); + $request = $this->sendRequest($batched_behavioral_event_http_completion_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -268,26 +256,26 @@ function ($exception) { } /** - * Create request for operation 'purge' + * Create request for operation 'send' * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * @param \HubSpot\Client\Events\Send\Model\BatchedBehavioralEventHttpCompletionRequest $batched_behavioral_event_http_completion_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + public function sendRequest($batched_behavioral_event_http_completion_request, string $contentType = self::contentTypes['send'][0]) { - // verify the required parameter 'public_gdpr_delete_input' is set - if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { + // verify the required parameter 'batched_behavioral_event_http_completion_request' is set + if ($batched_behavioral_event_http_completion_request === null || (is_array($batched_behavioral_event_http_completion_request) && count($batched_behavioral_event_http_completion_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $public_gdpr_delete_input when calling purge' + 'Missing the required parameter $batched_behavioral_event_http_completion_request when calling send' ); } - $resourcePath = '/crm/v3/objects/contacts/gdpr-delete'; + $resourcePath = '/events/v3/send/batch'; $formParams = []; $queryParams = []; $headerParams = []; @@ -305,12 +293,12 @@ public function purgeRequest($public_gdpr_delete_input, string $contentType = se ); // for model (json/xml) - if (isset($public_gdpr_delete_input)) { + if (isset($batched_behavioral_event_http_completion_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batched_behavioral_event_http_completion_request)); } else { - $httpBody = $public_gdpr_delete_input; + $httpBody = $batched_behavioral_event_http_completion_request; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/codegen/Events/Send/ApiException.php b/codegen/Events/Send/ApiException.php index 546f0223e..54995f53a 100644 --- a/codegen/Events/Send/ApiException.php +++ b/codegen/Events/Send/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Events/Send/Configuration.php b/codegen/Events/Send/Configuration.php index ea6b73539..9e89fa6df 100644 --- a/codegen/Events/Send/Configuration.php +++ b/codegen/Events/Send/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Events/Send/HeaderSelector.php b/codegen/Events/Send/HeaderSelector.php index ce963eddf..89a6000e8 100644 --- a/codegen/Events/Send/HeaderSelector.php +++ b/codegen/Events/Send/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Events/Send/Model/BatchedBehavioralEventHttpCompletionRequest.php b/codegen/Events/Send/Model/BatchedBehavioralEventHttpCompletionRequest.php new file mode 100644 index 000000000..4342d7254 --- /dev/null +++ b/codegen/Events/Send/Model/BatchedBehavioralEventHttpCompletionRequest.php @@ -0,0 +1,412 @@ + + */ +class BatchedBehavioralEventHttpCompletionRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchedBehavioralEventHttpCompletionRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Events/Send/Model/BehavioralEventHttpCompletionRequest.php b/codegen/Events/Send/Model/BehavioralEventHttpCompletionRequest.php index a413cae81..e9e62d995 100644 --- a/codegen/Events/Send/Model/BehavioralEventHttpCompletionRequest.php +++ b/codegen/Events/Send/Model/BehavioralEventHttpCompletionRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('occurred_at', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); @@ -347,7 +347,7 @@ public function getOccurredAt() /** * Sets occurred_at * - * @param \DateTime|null $occurred_at The time when this event occurred (if any). If this isn't set, the current time will be used + * @param \DateTime|null $occurred_at The time when this event occurred. If this isn't set, the current time will be used. * * @return self */ @@ -374,7 +374,7 @@ public function getEventName() /** * Sets event_name * - * @param string $event_name Internal name of the event-type to trigger + * @param string $event_name The internal name of the event (`pe_eventName`). Can be retrieved through the [event definitions API](https://developers.hubspot.com/docs/reference/api/analytics-and-events/custom-events/custom-event-definitions#get-%2Fevents%2Fv3%2Fevent-definitions) or in [HubSpot's UI](https://knowledge.hubspot.com/reports/create-custom-behavioral-events-with-the-code-wizard#find-internal-name). * * @return self */ @@ -401,7 +401,7 @@ public function getUtk() /** * Sets utk * - * @param string|null $utk User token + * @param string|null $utk The visitor's usertoken. Used for associating the event data with a CRM record. * * @return self */ @@ -428,7 +428,7 @@ public function getUuid() /** * Sets uuid * - * @param string|null $uuid uuid + * @param string|null $uuid Include a universally unique identifier to assign a unique ID to the event completion. Can be useful for matching data between HubSpot and other external systems. * * @return self */ @@ -455,7 +455,7 @@ public function getEmail() /** * Sets email * - * @param string|null $email Email of visitor + * @param string|null $email The visitor's email address. Used for associating the event data with a CRM record. * * @return self */ @@ -482,7 +482,7 @@ public function getProperties() /** * Sets properties * - * @param array|null $properties Map of properties for the event in the format property internal name - property value + * @param array|null $properties The event properties to update. Takes the format of key-value pairs (property internal name and property value). Learn more about [HubSpot's default event properties](https://developers.hubspot.com/docs/guides/api/analytics-and-events/custom-events/custom-event-definitions#hubspot-s-default-event-properties). * * @return self */ @@ -509,7 +509,7 @@ public function getObjectId() /** * Sets object_id * - * @param string|null $object_id The object id that this event occurred on. Could be a contact id or a visitor id. + * @param string|null $object_id The ID of the object that completed the event (e.g., contact ID or visitor ID). * * @return self */ diff --git a/codegen/Events/Send/Model/Error.php b/codegen/Events/Send/Model/Error.php index 3b6aa5abd..95f0407a1 100644 --- a/codegen/Events/Send/Model/Error.php +++ b/codegen/Events/Send/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Events/Send/Model/ErrorDetail.php b/codegen/Events/Send/Model/ErrorDetail.php index 7925b09e9..2751ca405 100644 --- a/codegen/Events/Send/Model/ErrorDetail.php +++ b/codegen/Events/Send/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Events/Send/Model/ModelInterface.php b/codegen/Events/Send/Model/ModelInterface.php index a9c080373..a74b8eba9 100644 --- a/codegen/Events/Send/Model/ModelInterface.php +++ b/codegen/Events/Send/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Events/Send/ObjectSerializer.php b/codegen/Events/Send/ObjectSerializer.php index b89a3f1d5..784f89cf9 100644 --- a/codegen/Events/Send/ObjectSerializer.php +++ b/codegen/Events/Send/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Files/Api/FilesApi.php b/codegen/Files/Api/FilesApi.php index 8f0044e09..a1d956e8e 100644 --- a/codegen/Files/Api/FilesApi.php +++ b/codegen/Files/Api/FilesApi.php @@ -10,13 +10,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -74,10 +74,10 @@ class FilesApi 'archive' => [ 'application/json', ], - 'archiveGDPR' => [ + 'checkImport' => [ 'application/json', ], - 'checkImport' => [ + 'delete' => [ 'application/json', ], 'doSearch' => [ @@ -113,13 +113,13 @@ class FilesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -155,7 +155,7 @@ public function getConfig() /** * Operation archive * - * Delete file + * Delete file by ID * * @param string $file_id FileId to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -172,7 +172,7 @@ public function archive($file_id, string $contentType = self::contentTypes['arch /** * Operation archiveWithHttpInfo * - * Delete file + * Delete file by ID * * @param string $file_id FileId to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -207,18 +207,6 @@ public function archiveWithHttpInfo($file_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -240,7 +228,7 @@ public function archiveWithHttpInfo($file_id, string $contentType = self::conten /** * Operation archiveAsync * - * Delete file + * Delete file by ID * * @param string $file_id FileId to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -261,7 +249,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Delete file + * Delete file by ID * * @param string $file_id FileId to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -397,37 +385,38 @@ public function archiveRequest($file_id, string $contentType = self::contentType } /** - * Operation archiveGDPR + * Operation checkImport * - * GDPR delete + * Check import status * - * @param string $file_id ID of file to GDPR delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveGDPR'] to see the possible values for this operation + * @param string $task_id Import by URL task ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Files\Model\FileActionResponse|\HubSpot\Client\Files\Model\Error */ - public function archiveGDPR($file_id, string $contentType = self::contentTypes['archiveGDPR'][0]) + public function checkImport($task_id, string $contentType = self::contentTypes['checkImport'][0]) { - $this->archiveGDPRWithHttpInfo($file_id, $contentType); + list($response) = $this->checkImportWithHttpInfo($task_id, $contentType); + return $response; } /** - * Operation archiveGDPRWithHttpInfo + * Operation checkImportWithHttpInfo * - * GDPR delete + * Check import status * - * @param string $file_id ID of file to GDPR delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveGDPR'] to see the possible values for this operation + * @param string $task_id Import by URL task ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Files\Model\FileActionResponse|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function archiveGDPRWithHttpInfo($file_id, string $contentType = self::contentTypes['archiveGDPR'][0]) + public function checkImportWithHttpInfo($task_id, string $contentType = self::contentTypes['checkImport'][0]) { - $request = $this->archiveGDPRRequest($file_id, $contentType); + $request = $this->checkImportRequest($task_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -451,6 +440,64 @@ public function archiveGDPRWithHttpInfo($file_id, string $contentType = self::co $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Files\Model\FileActionResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Files\Model\FileActionResponse' !== '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\Files\Model\FileActionResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Files\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\Files\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -464,10 +511,44 @@ public function archiveGDPRWithHttpInfo($file_id, string $contentType = self::co ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\HubSpot\Client\Files\Model\FileActionResponse'; + 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() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Files\Model\FileActionResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -482,19 +563,19 @@ public function archiveGDPRWithHttpInfo($file_id, string $contentType = self::co } /** - * Operation archiveGDPRAsync + * Operation checkImportAsync * - * GDPR delete + * Check import status * - * @param string $file_id ID of file to GDPR delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveGDPR'] to see the possible values for this operation + * @param string $task_id Import by URL task ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveGDPRAsync($file_id, string $contentType = self::contentTypes['archiveGDPR'][0]) + public function checkImportAsync($task_id, string $contentType = self::contentTypes['checkImport'][0]) { - return $this->archiveGDPRAsyncWithHttpInfo($file_id, $contentType) + return $this->checkImportAsyncWithHttpInfo($task_id, $contentType) ->then( function ($response) { return $response[0]; @@ -503,26 +584,39 @@ function ($response) { } /** - * Operation archiveGDPRAsyncWithHttpInfo + * Operation checkImportAsyncWithHttpInfo * - * GDPR delete + * Check import status * - * @param string $file_id ID of file to GDPR delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveGDPR'] to see the possible values for this operation + * @param string $task_id Import by URL task ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveGDPRAsyncWithHttpInfo($file_id, string $contentType = self::contentTypes['archiveGDPR'][0]) + public function checkImportAsyncWithHttpInfo($task_id, string $contentType = self::contentTypes['checkImport'][0]) { - $returnType = ''; - $request = $this->archiveGDPRRequest($file_id, $contentType); + $returnType = '\HubSpot\Client\Files\Model\FileActionResponse'; + $request = $this->checkImportRequest($task_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -542,29 +636,26 @@ function ($exception) { } /** - * Create request for operation 'archiveGDPR' + * Create request for operation 'checkImport' * - * @param string $file_id ID of file to GDPR delete (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveGDPR'] to see the possible values for this operation + * @param string $task_id Import by URL task ID (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveGDPRRequest($file_id, string $contentType = self::contentTypes['archiveGDPR'][0]) + public function checkImportRequest($task_id, string $contentType = self::contentTypes['checkImport'][0]) { - // verify the required parameter 'file_id' is set - if ($file_id === null || (is_array($file_id) && count($file_id) === 0)) { + // verify the required parameter 'task_id' is set + if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $file_id when calling archiveGDPR' + 'Missing the required parameter $task_id when calling checkImport' ); } - if (!preg_match("/\\d+/", $file_id)) { - throw new \InvalidArgumentException("invalid value for \"file_id\" when calling FilesApi.archiveGDPR, must conform to the pattern /\\d+/."); - } - - $resourcePath = '/files/v3/files/{fileId}/gdpr-delete'; + + $resourcePath = '/files/v3/files/import-from-url/async/tasks/{taskId}/status'; $formParams = []; $queryParams = []; $headerParams = []; @@ -574,17 +665,17 @@ public function archiveGDPRRequest($file_id, string $contentType = self::content // path params - if ($file_id !== null) { + if ($task_id !== null) { $resourcePath = str_replace( - '{' . 'fileId' . '}', - ObjectSerializer::toPathValue($file_id), + '{' . 'taskId' . '}', + ObjectSerializer::toPathValue($task_id), $resourcePath ); } $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); @@ -633,7 +724,7 @@ public function archiveGDPRRequest($file_id, string $contentType = self::content $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -641,38 +732,37 @@ public function archiveGDPRRequest($file_id, string $contentType = self::content } /** - * Operation checkImport + * Operation delete * - * Check import status. + * GDPR-delete file * - * @param string $task_id Import by URL task ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation + * @param string $file_id ID of file to GDPR delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['delete'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Files\Model\FileActionResponse|\HubSpot\Client\Files\Model\Error + * @return void */ - public function checkImport($task_id, string $contentType = self::contentTypes['checkImport'][0]) + public function delete($file_id, string $contentType = self::contentTypes['delete'][0]) { - list($response) = $this->checkImportWithHttpInfo($task_id, $contentType); - return $response; + $this->deleteWithHttpInfo($file_id, $contentType); } /** - * Operation checkImportWithHttpInfo + * Operation deleteWithHttpInfo * - * Check import status. + * GDPR-delete file * - * @param string $task_id Import by URL task ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation + * @param string $file_id ID of file to GDPR delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['delete'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Files\Model\FileActionResponse|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function checkImportWithHttpInfo($task_id, string $contentType = self::contentTypes['checkImport'][0]) + public function deleteWithHttpInfo($file_id, string $contentType = self::contentTypes['delete'][0]) { - $request = $this->checkImportRequest($task_id, $contentType); + $request = $this->deleteRequest($file_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -696,114 +786,11 @@ public function checkImportWithHttpInfo($task_id, string $contentType = self::co $statusCode = $response->getStatusCode(); - 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() - ); - } - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Files\Model\FileActionResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\FileActionResponse' !== '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\Files\Model\FileActionResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Files\Model\FileActionResponse'; - 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 [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Files\Model\FileActionResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -818,19 +805,19 @@ public function checkImportWithHttpInfo($task_id, string $contentType = self::co } /** - * Operation checkImportAsync + * Operation deleteAsync * - * Check import status. + * GDPR-delete file * - * @param string $task_id Import by URL task ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation + * @param string $file_id ID of file to GDPR delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['delete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function checkImportAsync($task_id, string $contentType = self::contentTypes['checkImport'][0]) + public function deleteAsync($file_id, string $contentType = self::contentTypes['delete'][0]) { - return $this->checkImportAsyncWithHttpInfo($task_id, $contentType) + return $this->deleteAsyncWithHttpInfo($file_id, $contentType) ->then( function ($response) { return $response[0]; @@ -839,39 +826,26 @@ function ($response) { } /** - * Operation checkImportAsyncWithHttpInfo + * Operation deleteAsyncWithHttpInfo * - * Check import status. + * GDPR-delete file * - * @param string $task_id Import by URL task ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation + * @param string $file_id ID of file to GDPR delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['delete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function checkImportAsyncWithHttpInfo($task_id, string $contentType = self::contentTypes['checkImport'][0]) + public function deleteAsyncWithHttpInfo($file_id, string $contentType = self::contentTypes['delete'][0]) { - $returnType = '\HubSpot\Client\Files\Model\FileActionResponse'; - $request = $this->checkImportRequest($task_id, $contentType); + $returnType = ''; + $request = $this->deleteRequest($file_id, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -891,26 +865,29 @@ function ($exception) { } /** - * Create request for operation 'checkImport' + * Create request for operation 'delete' * - * @param string $task_id Import by URL task ID (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkImport'] to see the possible values for this operation + * @param string $file_id ID of file to GDPR delete (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['delete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function checkImportRequest($task_id, string $contentType = self::contentTypes['checkImport'][0]) + public function deleteRequest($file_id, string $contentType = self::contentTypes['delete'][0]) { - // verify the required parameter 'task_id' is set - if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { + // verify the required parameter 'file_id' is set + if ($file_id === null || (is_array($file_id) && count($file_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $task_id when calling checkImport' + 'Missing the required parameter $file_id when calling delete' ); } + if (!preg_match("/\\d+/", $file_id)) { + throw new \InvalidArgumentException("invalid value for \"file_id\" when calling FilesApi.delete, must conform to the pattern /\\d+/."); + } + - - $resourcePath = '/files/v3/files/import-from-url/async/tasks/{taskId}/status'; + $resourcePath = '/files/v3/files/{fileId}/gdpr-delete'; $formParams = []; $queryParams = []; $headerParams = []; @@ -920,17 +897,17 @@ public function checkImportRequest($task_id, string $contentType = self::content // path params - if ($task_id !== null) { + if ($file_id !== null) { $resourcePath = str_replace( - '{' . 'taskId' . '}', - ObjectSerializer::toPathValue($task_id), + '{' . 'fileId' . '}', + ObjectSerializer::toPathValue($file_id), $resourcePath ); } $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], + ['*/*', ], $contentType, $multipart ); @@ -979,7 +956,7 @@ public function checkImportRequest($task_id, string $contentType = self::content $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -991,39 +968,51 @@ public function checkImportRequest($task_id, string $contentType = self::content * * Search files * - * @param string[] $properties Desired file properties in the return object. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before before (optional) - * @param int $limit Number of items to return. Maximum limit is 100. (optional) - * @param string[] $sort Sort files by a given field. (optional) - * @param string $id Search files by given ID. (optional) - * @param \DateTime $created_at Search files by time of creation. (optional) - * @param \DateTime $created_at_lte created_at_lte (optional) - * @param \DateTime $created_at_gte created_at_gte (optional) - * @param \DateTime $updated_at Search files by time of latest updated. (optional) - * @param \DateTime $updated_at_lte updated_at_lte (optional) - * @param \DateTime $updated_at_gte updated_at_gte (optional) - * @param string $name Search for files containing the given name. (optional) - * @param string $path Search files by path. (optional) - * @param int $parent_folder_id Search files within given folderId. (optional) - * @param int $size Query by file size. (optional) - * @param int $height Search files by height of image or video. (optional) - * @param int $width Search files by width of image or video. (optional) - * @param string $encoding Search files with specified encoding. (optional) - * @param string $type Filter by provided file type. (optional) - * @param string $extension Search files by given extension. (optional) - * @param string $url Search for given URL (optional) - * @param bool $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) - * @param bool $allows_anonymous_access If 'true' will show private files; if 'false' will show public files (optional) + * @param string[]|null $properties A list of file properties to return. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort files by a given field. (optional) + * @param int[]|null $ids Search by a list of file IDs. (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search files by time of creation. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) + * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param string|null $name Search for files containing the given name. (optional) + * @param string|null $path Search files by path. (optional) + * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int|null $size Search files by exact file size in bytes. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $height Search files by height of image or video. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $width Search files by width of image or video. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param string|null $encoding Search files by specified encoding. (optional) + * @param string|null $type Filter by provided file type. (optional) + * @param string|null $extension Search files by given extension. (optional) + * @param string|null $url Search by file URL. (optional) + * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) + * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) * @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\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Files\Model\CollectionResponseFile|\HubSpot\Client\Files\Model\Error */ - public function doSearch($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, $size = null, $height = null, $width = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearch($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, $size = null, $size_lte = null, $size_gte = null, $height = null, $height_lte = null, $height_gte = null, $width = null, $width_lte = null, $width_gte = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, $file_md5 = null, $expires_at = null, $expires_at_lte = null, $expires_at_gte = null, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $size, $height, $width, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $contentType); + list($response) = $this->doSearchWithHttpInfo($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $size, $size_lte, $size_gte, $height, $height_lte, $height_gte, $width, $width_lte, $width_gte, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $file_md5, $expires_at, $expires_at_lte, $expires_at_gte, $contentType); return $response; } @@ -1032,39 +1021,51 @@ public function doSearch($properties = null, $after = null, $before = null, $lim * * Search files * - * @param string[] $properties Desired file properties in the return object. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Number of items to return. Maximum limit is 100. (optional) - * @param string[] $sort Sort files by a given field. (optional) - * @param string $id Search files by given ID. (optional) - * @param \DateTime $created_at Search files by time of creation. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search files by time of latest updated. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for files containing the given name. (optional) - * @param string $path Search files by path. (optional) - * @param int $parent_folder_id Search files within given folderId. (optional) - * @param int $size Query by file size. (optional) - * @param int $height Search files by height of image or video. (optional) - * @param int $width Search files by width of image or video. (optional) - * @param string $encoding Search files with specified encoding. (optional) - * @param string $type Filter by provided file type. (optional) - * @param string $extension Search files by given extension. (optional) - * @param string $url Search for given URL (optional) - * @param bool $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) - * @param bool $allows_anonymous_access If 'true' will show private files; if 'false' will show public files (optional) + * @param string[]|null $properties A list of file properties to return. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort files by a given field. (optional) + * @param int[]|null $ids Search by a list of file IDs. (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search files by time of creation. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) + * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param string|null $name Search for files containing the given name. (optional) + * @param string|null $path Search files by path. (optional) + * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int|null $size Search files by exact file size in bytes. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $height Search files by height of image or video. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $width Search files by width of image or video. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param string|null $encoding Search files by specified encoding. (optional) + * @param string|null $type Filter by provided file type. (optional) + * @param string|null $extension Search files by given extension. (optional) + * @param string|null $url Search by file URL. (optional) + * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) + * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) * @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\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Files\Model\CollectionResponseFile|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, $size = null, $height = null, $width = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, $size = null, $size_lte = null, $size_gte = null, $height = null, $height_lte = null, $height_gte = null, $width = null, $width_lte = null, $width_gte = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, $file_md5 = null, $expires_at = null, $expires_at_lte = null, $expires_at_gte = null, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $size, $height, $width, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $contentType); + $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $size, $size_lte, $size_gte, $height, $height_lte, $height_gte, $width, $width_lte, $width_gte, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $file_md5, $expires_at, $expires_at_lte, $expires_at_gte, $contentType); try { $options = $this->createHttpClientOption(); @@ -1088,18 +1089,6 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1158,6 +1147,19 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\CollectionResponseFile'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1214,38 +1216,50 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before * * Search files * - * @param string[] $properties Desired file properties in the return object. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Number of items to return. Maximum limit is 100. (optional) - * @param string[] $sort Sort files by a given field. (optional) - * @param string $id Search files by given ID. (optional) - * @param \DateTime $created_at Search files by time of creation. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search files by time of latest updated. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for files containing the given name. (optional) - * @param string $path Search files by path. (optional) - * @param int $parent_folder_id Search files within given folderId. (optional) - * @param int $size Query by file size. (optional) - * @param int $height Search files by height of image or video. (optional) - * @param int $width Search files by width of image or video. (optional) - * @param string $encoding Search files with specified encoding. (optional) - * @param string $type Filter by provided file type. (optional) - * @param string $extension Search files by given extension. (optional) - * @param string $url Search for given URL (optional) - * @param bool $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) - * @param bool $allows_anonymous_access If 'true' will show private files; if 'false' will show public files (optional) + * @param string[]|null $properties A list of file properties to return. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort files by a given field. (optional) + * @param int[]|null $ids Search by a list of file IDs. (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search files by time of creation. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) + * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param string|null $name Search for files containing the given name. (optional) + * @param string|null $path Search files by path. (optional) + * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int|null $size Search files by exact file size in bytes. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $height Search files by height of image or video. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $width Search files by width of image or video. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param string|null $encoding Search files by specified encoding. (optional) + * @param string|null $type Filter by provided file type. (optional) + * @param string|null $extension Search files by given extension. (optional) + * @param string|null $url Search by file URL. (optional) + * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) + * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, $size = null, $height = null, $width = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchAsync($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, $size = null, $size_lte = null, $size_gte = null, $height = null, $height_lte = null, $height_gte = null, $width = null, $width_lte = null, $width_gte = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, $file_md5 = null, $expires_at = null, $expires_at_lte = null, $expires_at_gte = null, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $size, $height, $width, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $contentType) + return $this->doSearchAsyncWithHttpInfo($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $size, $size_lte, $size_gte, $height, $height_lte, $height_gte, $width, $width_lte, $width_gte, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $file_md5, $expires_at, $expires_at_lte, $expires_at_gte, $contentType) ->then( function ($response) { return $response[0]; @@ -1258,39 +1272,51 @@ function ($response) { * * Search files * - * @param string[] $properties Desired file properties in the return object. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Number of items to return. Maximum limit is 100. (optional) - * @param string[] $sort Sort files by a given field. (optional) - * @param string $id Search files by given ID. (optional) - * @param \DateTime $created_at Search files by time of creation. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search files by time of latest updated. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for files containing the given name. (optional) - * @param string $path Search files by path. (optional) - * @param int $parent_folder_id Search files within given folderId. (optional) - * @param int $size Query by file size. (optional) - * @param int $height Search files by height of image or video. (optional) - * @param int $width Search files by width of image or video. (optional) - * @param string $encoding Search files with specified encoding. (optional) - * @param string $type Filter by provided file type. (optional) - * @param string $extension Search files by given extension. (optional) - * @param string $url Search for given URL (optional) - * @param bool $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) - * @param bool $allows_anonymous_access If 'true' will show private files; if 'false' will show public files (optional) + * @param string[]|null $properties A list of file properties to return. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort files by a given field. (optional) + * @param int[]|null $ids Search by a list of file IDs. (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search files by time of creation. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) + * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param string|null $name Search for files containing the given name. (optional) + * @param string|null $path Search files by path. (optional) + * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int|null $size Search files by exact file size in bytes. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $height Search files by height of image or video. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $width Search files by width of image or video. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param string|null $encoding Search files by specified encoding. (optional) + * @param string|null $type Filter by provided file type. (optional) + * @param string|null $extension Search files by given extension. (optional) + * @param string|null $url Search by file URL. (optional) + * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) + * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, $size = null, $height = null, $width = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchAsyncWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, $size = null, $size_lte = null, $size_gte = null, $height = null, $height_lte = null, $height_gte = null, $width = null, $width_lte = null, $width_gte = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, $file_md5 = null, $expires_at = null, $expires_at_lte = null, $expires_at_gte = null, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Files\Model\CollectionResponseFile'; - $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $size, $height, $width, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $contentType); + $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $size, $size_lte, $size_gte, $height, $height_lte, $height_gte, $width, $width_lte, $width_gte, $encoding, $type, $extension, $url, $is_usable_in_content, $allows_anonymous_access, $file_md5, $expires_at, $expires_at_lte, $expires_at_gte, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1331,36 +1357,48 @@ function ($exception) { /** * Create request for operation 'doSearch' * - * @param string[] $properties Desired file properties in the return object. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Number of items to return. Maximum limit is 100. (optional) - * @param string[] $sort Sort files by a given field. (optional) - * @param string $id Search files by given ID. (optional) - * @param \DateTime $created_at Search files by time of creation. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search files by time of latest updated. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for files containing the given name. (optional) - * @param string $path Search files by path. (optional) - * @param int $parent_folder_id Search files within given folderId. (optional) - * @param int $size Query by file size. (optional) - * @param int $height Search files by height of image or video. (optional) - * @param int $width Search files by width of image or video. (optional) - * @param string $encoding Search files with specified encoding. (optional) - * @param string $type Filter by provided file type. (optional) - * @param string $extension Search files by given extension. (optional) - * @param string $url Search for given URL (optional) - * @param bool $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) - * @param bool $allows_anonymous_access If 'true' will show private files; if 'false' will show public files (optional) + * @param string[]|null $properties A list of file properties to return. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort files by a given field. (optional) + * @param int[]|null $ids Search by a list of file IDs. (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search files by time of creation. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) + * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param string|null $name Search for files containing the given name. (optional) + * @param string|null $path Search files by path. (optional) + * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int|null $size Search files by exact file size in bytes. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $height Search files by height of image or video. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $width Search files by width of image or video. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param string|null $encoding Search files by specified encoding. (optional) + * @param string|null $type Filter by provided file type. (optional) + * @param string|null $extension Search files by given extension. (optional) + * @param string|null $url Search by file URL. (optional) + * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) + * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, $size = null, $height = null, $width = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchRequest($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, $size = null, $size_lte = null, $size_gte = null, $height = null, $height_lte = null, $height_gte = null, $width = null, $width_lte = null, $width_gte = null, $encoding = null, $type = null, $extension = null, $url = null, $is_usable_in_content = null, $allows_anonymous_access = null, $file_md5 = null, $expires_at = null, $expires_at_lte = null, $expires_at_gte = null, string $contentType = self::contentTypes['doSearch'][0]) { @@ -1379,6 +1417,18 @@ public function doSearchRequest($properties = null, $after = null, $before = nul + + + + + + + + + + + + @@ -1442,9 +1492,27 @@ public function doSearchRequest($properties = null, $after = null, $before = nul ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $id, - 'id', // param base name - 'string', // openApiType + $ids, + 'ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_lte, + 'idLte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_gte, + 'idGte', // param base name + 'integer', // openApiType 'form', // style true, // explode false // required @@ -1523,9 +1591,9 @@ public function doSearchRequest($properties = null, $after = null, $before = nul ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $parent_folder_id, - 'parentFolderId', // param base name - 'integer', // openApiType + $parent_folder_ids, + 'parentFolderIds', // param base name + 'array', // openApiType 'form', // style true, // explode false // required @@ -1540,6 +1608,24 @@ public function doSearchRequest($properties = null, $after = null, $before = nul false // required ) ?? []); // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size_lte, + 'sizeLte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size_gte, + 'sizeGte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $height, 'height', // param base name @@ -1549,6 +1635,24 @@ public function doSearchRequest($properties = null, $after = null, $before = nul false // required ) ?? []); // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $height_lte, + 'heightLte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $height_gte, + 'heightGte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $width, 'width', // param base name @@ -1558,6 +1662,24 @@ public function doSearchRequest($properties = null, $after = null, $before = nul false // required ) ?? []); // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $width_lte, + 'widthLte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $width_gte, + 'widthGte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $encoding, 'encoding', // param base name @@ -1611,6 +1733,42 @@ public function doSearchRequest($properties = null, $after = null, $before = nul true, // explode false // required ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $file_md5, + 'fileMd5', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_at, + 'expiresAt', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_at_lte, + 'expiresAtLte', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expires_at_gte, + 'expiresAtGte', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); @@ -1675,10 +1833,10 @@ public function doSearchRequest($properties = null, $after = null, $before = nul /** * Operation getById * - * Get file. + * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[] $properties properties (optional) + * @param string[]|null $properties null (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1694,10 +1852,10 @@ public function getById($file_id, $properties = null, string $contentType = self /** * Operation getByIdWithHttpInfo * - * Get file. + * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[] $properties (optional) + * @param string[]|null $properties null (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1730,18 +1888,6 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1800,6 +1946,19 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\File'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1854,10 +2013,10 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten /** * Operation getByIdAsync * - * Get file. + * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[] $properties (optional) + * @param string[]|null $properties null (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1876,10 +2035,10 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Get file. + * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[] $properties (optional) + * @param string[]|null $properties null (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1930,7 +2089,7 @@ function ($exception) { * Create request for operation 'getById' * * @param string $file_id ID of the desired file. (required) - * @param string[] $properties (optional) + * @param string[]|null $properties null (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2039,8 +2198,10 @@ public function getByIdRequest($file_id, $properties = null, string $contentType /** * Operation getMetadata * - * @param string $path path (required) - * @param string[] $properties properties (optional) + * Retrieve file by path + * + * @param string $path The path of the file. (required) + * @param string[]|null $properties Properties to return in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2056,8 +2217,10 @@ public function getMetadata($path, $properties = null, string $contentType = sel /** * Operation getMetadataWithHttpInfo * - * @param string $path (required) - * @param string[] $properties (optional) + * Retrieve file by path + * + * @param string $path The path of the file. (required) + * @param string[]|null $properties Properties to return in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2090,18 +2253,6 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2160,6 +2311,19 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\FileStat'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2214,8 +2378,10 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte /** * Operation getMetadataAsync * - * @param string $path (required) - * @param string[] $properties (optional) + * Retrieve file by path + * + * @param string $path The path of the file. (required) + * @param string[]|null $properties Properties to return in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2234,8 +2400,10 @@ function ($response) { /** * Operation getMetadataAsyncWithHttpInfo * - * @param string $path (required) - * @param string[] $properties (optional) + * Retrieve file by path + * + * @param string $path The path of the file. (required) + * @param string[]|null $properties Properties to return in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2285,8 +2453,8 @@ function ($exception) { /** * Create request for operation 'getMetadata' * - * @param string $path (required) - * @param string[] $properties (optional) + * @param string $path The path of the file. (required) + * @param string[]|null $properties Properties to return in the response. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2395,12 +2563,12 @@ public function getMetadataRequest($path, $properties = null, string $contentTyp /** * Operation getSignedUrl * - * Get signed URL to access private file. + * Get signed URL to access private file * * @param string $file_id ID of file. (required) - * @param string $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) - * @param int $expiration_seconds How long in seconds the link will provide access to the file. (optional) - * @param bool $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) + * @param string|null $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) + * @param int|null $expiration_seconds How long in seconds the link will provide access to the file. (optional) + * @param bool|null $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSignedUrl'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2416,12 +2584,12 @@ public function getSignedUrl($file_id, $size = null, $expiration_seconds = null, /** * Operation getSignedUrlWithHttpInfo * - * Get signed URL to access private file. + * Get signed URL to access private file * * @param string $file_id ID of file. (required) - * @param string $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) - * @param int $expiration_seconds How long in seconds the link will provide access to the file. (optional) - * @param bool $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) + * @param string|null $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) + * @param int|null $expiration_seconds How long in seconds the link will provide access to the file. (optional) + * @param bool|null $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSignedUrl'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2454,18 +2622,6 @@ public function getSignedUrlWithHttpInfo($file_id, $size = null, $expiration_sec $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2524,6 +2680,19 @@ public function getSignedUrlWithHttpInfo($file_id, $size = null, $expiration_sec ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\SignedUrl'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2578,12 +2747,12 @@ public function getSignedUrlWithHttpInfo($file_id, $size = null, $expiration_sec /** * Operation getSignedUrlAsync * - * Get signed URL to access private file. + * Get signed URL to access private file * * @param string $file_id ID of file. (required) - * @param string $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) - * @param int $expiration_seconds How long in seconds the link will provide access to the file. (optional) - * @param bool $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) + * @param string|null $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) + * @param int|null $expiration_seconds How long in seconds the link will provide access to the file. (optional) + * @param bool|null $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSignedUrl'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2602,12 +2771,12 @@ function ($response) { /** * Operation getSignedUrlAsyncWithHttpInfo * - * Get signed URL to access private file. + * Get signed URL to access private file * * @param string $file_id ID of file. (required) - * @param string $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) - * @param int $expiration_seconds How long in seconds the link will provide access to the file. (optional) - * @param bool $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) + * @param string|null $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) + * @param int|null $expiration_seconds How long in seconds the link will provide access to the file. (optional) + * @param bool|null $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSignedUrl'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2658,9 +2827,9 @@ function ($exception) { * Create request for operation 'getSignedUrl' * * @param string $file_id ID of file. (required) - * @param string $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) - * @param int $expiration_seconds How long in seconds the link will provide access to the file. (optional) - * @param bool $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) + * @param string|null $size For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL. (optional) + * @param int|null $expiration_seconds How long in seconds the link will provide access to the file. (optional) + * @param bool|null $upscale If size is provided, this will upscale the image to fit the size dimensions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSignedUrl'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2789,7 +2958,7 @@ public function getSignedUrlRequest($file_id, $size = null, $expiration_seconds /** * Operation importFromUrl * - * Import a file from a URL into the file manager. + * Import file from URL * * @param \HubSpot\Client\Files\Model\ImportFromUrlInput $import_from_url_input import_from_url_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importFromUrl'] to see the possible values for this operation @@ -2807,7 +2976,7 @@ public function importFromUrl($import_from_url_input, string $contentType = self /** * Operation importFromUrlWithHttpInfo * - * Import a file from a URL into the file manager. + * Import file from URL * * @param \HubSpot\Client\Files\Model\ImportFromUrlInput $import_from_url_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importFromUrl'] to see the possible values for this operation @@ -2842,18 +3011,6 @@ public function importFromUrlWithHttpInfo($import_from_url_input, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 202: @@ -2912,6 +3069,19 @@ public function importFromUrlWithHttpInfo($import_from_url_input, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\ImportFromUrlTaskLocator'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2966,7 +3136,7 @@ public function importFromUrlWithHttpInfo($import_from_url_input, string $conten /** * Operation importFromUrlAsync * - * Import a file from a URL into the file manager. + * Import file from URL * * @param \HubSpot\Client\Files\Model\ImportFromUrlInput $import_from_url_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importFromUrl'] to see the possible values for this operation @@ -2987,7 +3157,7 @@ function ($response) { /** * Operation importFromUrlAsyncWithHttpInfo * - * Import a file from a URL into the file manager. + * Import file from URL * * @param \HubSpot\Client\Files\Model\ImportFromUrlInput $import_from_url_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importFromUrl'] to see the possible values for this operation @@ -3134,12 +3304,12 @@ public function importFromUrlRequest($import_from_url_input, string $contentType /** * Operation replace * - * Replace file. + * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject $file File data that will replace existing file in the file manager. (optional) - * @param string $charset_hunch Character set of given file data. (optional) - * @param string $options JSON String representing FileReplaceOptions (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) + * @param string|null $charset_hunch Character set of given file data. (optional) + * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -3155,12 +3325,12 @@ public function replace($file_id, $file = null, $charset_hunch = null, $options /** * Operation replaceWithHttpInfo * - * Replace file. + * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject $file File data that will replace existing file in the file manager. (optional) - * @param string $charset_hunch Character set of given file data. (optional) - * @param string $options JSON String representing FileReplaceOptions (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) + * @param string|null $charset_hunch Character set of given file data. (optional) + * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -3193,18 +3363,6 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3263,6 +3421,19 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\File'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3317,12 +3488,12 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul /** * Operation replaceAsync * - * Replace file. + * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject $file File data that will replace existing file in the file manager. (optional) - * @param string $charset_hunch Character set of given file data. (optional) - * @param string $options JSON String representing FileReplaceOptions (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) + * @param string|null $charset_hunch Character set of given file data. (optional) + * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3341,12 +3512,12 @@ function ($response) { /** * Operation replaceAsyncWithHttpInfo * - * Replace file. + * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject $file File data that will replace existing file in the file manager. (optional) - * @param string $charset_hunch Character set of given file data. (optional) - * @param string $options JSON String representing FileReplaceOptions (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) + * @param string|null $charset_hunch Character set of given file data. (optional) + * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3397,9 +3568,9 @@ function ($exception) { * Create request for operation 'replace' * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject $file File data that will replace existing file in the file manager. (optional) - * @param string $charset_hunch Character set of given file data. (optional) - * @param string $options JSON String representing FileReplaceOptions (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) + * @param string|null $charset_hunch Character set of given file data. (optional) + * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3461,6 +3632,7 @@ public function replaceRequest($file_id, $file = null, $charset_hunch = null, $o $formParams['options'] = ObjectSerializer::toFormValue($options); } + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*', ], $contentType, @@ -3521,10 +3693,10 @@ public function replaceRequest($file_id, $file = null, $charset_hunch = null, $o /** * Operation updateProperties * - * update file properties + * Update file properties * * @param string $file_id ID of file to update (required) - * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input Options to update. (required) + * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input file_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -3540,10 +3712,10 @@ public function updateProperties($file_id, $file_update_input, string $contentTy /** * Operation updatePropertiesWithHttpInfo * - * update file properties + * Update file properties * * @param string $file_id ID of file to update (required) - * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input Options to update. (required) + * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -3576,18 +3748,6 @@ public function updatePropertiesWithHttpInfo($file_id, $file_update_input, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3646,6 +3806,19 @@ public function updatePropertiesWithHttpInfo($file_id, $file_update_input, strin ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\File'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3700,10 +3873,10 @@ public function updatePropertiesWithHttpInfo($file_id, $file_update_input, strin /** * Operation updatePropertiesAsync * - * update file properties + * Update file properties * * @param string $file_id ID of file to update (required) - * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input Options to update. (required) + * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3722,10 +3895,10 @@ function ($response) { /** * Operation updatePropertiesAsyncWithHttpInfo * - * update file properties + * Update file properties * * @param string $file_id ID of file to update (required) - * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input Options to update. (required) + * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3776,7 +3949,7 @@ function ($exception) { * Create request for operation 'updateProperties' * * @param string $file_id ID of file to update (required) - * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input Options to update. (required) + * @param \HubSpot\Client\Files\Model\FileUpdateInput $file_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -3891,12 +4064,12 @@ public function updatePropertiesRequest($file_id, $file_update_input, string $co * * Upload file * - * @param \SplFileObject $file File to be uploaded. (optional) - * @param string $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) - * @param string $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string $file_name Desired name for the uploaded file. (optional) - * @param string $charset_hunch Character set of the uploaded file. (optional) - * @param string $options JSON string representing FileUploadOptions. (optional) + * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) + * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) + * @param string|null $charset_hunch Character set of the uploaded file. (optional) + * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -3914,12 +4087,12 @@ public function upload($file = null, $folder_id = null, $folder_path = null, $fi * * Upload file * - * @param \SplFileObject $file File to be uploaded. (optional) - * @param string $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) - * @param string $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string $file_name Desired name for the uploaded file. (optional) - * @param string $charset_hunch Character set of the uploaded file. (optional) - * @param string $options JSON string representing FileUploadOptions. (optional) + * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) + * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) + * @param string|null $charset_hunch Character set of the uploaded file. (optional) + * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -3952,18 +4125,6 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -4022,6 +4183,19 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\File'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -4078,12 +4252,12 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path * * Upload file * - * @param \SplFileObject $file File to be uploaded. (optional) - * @param string $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) - * @param string $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string $file_name Desired name for the uploaded file. (optional) - * @param string $charset_hunch Character set of the uploaded file. (optional) - * @param string $options JSON string representing FileUploadOptions. (optional) + * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) + * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) + * @param string|null $charset_hunch Character set of the uploaded file. (optional) + * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4104,12 +4278,12 @@ function ($response) { * * Upload file * - * @param \SplFileObject $file File to be uploaded. (optional) - * @param string $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) - * @param string $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string $file_name Desired name for the uploaded file. (optional) - * @param string $charset_hunch Character set of the uploaded file. (optional) - * @param string $options JSON string representing FileUploadOptions. (optional) + * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) + * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) + * @param string|null $charset_hunch Character set of the uploaded file. (optional) + * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4159,12 +4333,12 @@ function ($exception) { /** * Create request for operation 'upload' * - * @param \SplFileObject $file File to be uploaded. (optional) - * @param string $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) - * @param string $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string $file_name Desired name for the uploaded file. (optional) - * @param string $charset_hunch Character set of the uploaded file. (optional) - * @param string $options JSON string representing FileUploadOptions. (optional) + * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) + * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) + * @param string|null $charset_hunch Character set of the uploaded file. (optional) + * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -4223,6 +4397,7 @@ public function uploadRequest($file = null, $folder_id = null, $folder_path = nu $formParams['options'] = ObjectSerializer::toFormValue($options); } + $multipart = true; $headers = $this->headerSelector->selectHeaders( ['application/json', '*/*', ], $contentType, diff --git a/codegen/Files/Api/FoldersApi.php b/codegen/Files/Api/FoldersApi.php index 2eb954881..4778eedda 100644 --- a/codegen/Files/Api/FoldersApi.php +++ b/codegen/Files/Api/FoldersApi.php @@ -10,13 +10,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,6 +95,9 @@ class FoldersApi 'updateProperties' => [ 'application/json', ], + 'updatePropertiesRecursively' => [ + 'application/json', + ], ]; /** @@ -104,13 +107,13 @@ class FoldersApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -146,7 +149,7 @@ public function getConfig() /** * Operation archive * - * Delete folder. + * Delete folder by ID * * @param string $folder_id ID of folder to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -163,7 +166,7 @@ public function archive($folder_id, string $contentType = self::contentTypes['ar /** * Operation archiveWithHttpInfo * - * Delete folder. + * Delete folder by ID * * @param string $folder_id ID of folder to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -198,18 +201,6 @@ public function archiveWithHttpInfo($folder_id, string $contentType = self::cont $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -231,7 +222,7 @@ public function archiveWithHttpInfo($folder_id, string $contentType = self::cont /** * Operation archiveAsync * - * Delete folder. + * Delete folder by ID * * @param string $folder_id ID of folder to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -252,7 +243,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Delete folder. + * Delete folder by ID * * @param string $folder_id ID of folder to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -390,7 +381,7 @@ public function archiveRequest($folder_id, string $contentType = self::contentTy /** * Operation archiveByPath * - * Delete folder. + * Delete folder by path * * @param string $folder_path Path of folder to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByPath'] to see the possible values for this operation @@ -407,7 +398,7 @@ public function archiveByPath($folder_path, string $contentType = self::contentT /** * Operation archiveByPathWithHttpInfo * - * Delete folder. + * Delete folder by path * * @param string $folder_path Path of folder to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByPath'] to see the possible values for this operation @@ -442,18 +433,6 @@ public function archiveByPathWithHttpInfo($folder_path, string $contentType = se $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -475,7 +454,7 @@ public function archiveByPathWithHttpInfo($folder_path, string $contentType = se /** * Operation archiveByPathAsync * - * Delete folder. + * Delete folder by path * * @param string $folder_path Path of folder to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByPath'] to see the possible values for this operation @@ -496,7 +475,7 @@ function ($response) { /** * Operation archiveByPathAsyncWithHttpInfo * - * Delete folder. + * Delete folder by path * * @param string $folder_path Path of folder to delete (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByPath'] to see the possible values for this operation @@ -634,9 +613,9 @@ public function archiveByPathRequest($folder_path, string $contentType = self::c /** * Operation checkUpdateStatus * - * Check folder update status. + * Check folder update status * - * @param string $task_id TaskId of folder update (required) + * @param string $task_id The ID of the folder update task. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -652,9 +631,9 @@ public function checkUpdateStatus($task_id, string $contentType = self::contentT /** * Operation checkUpdateStatusWithHttpInfo * - * Check folder update status. + * Check folder update status * - * @param string $task_id TaskId of folder update (required) + * @param string $task_id The ID of the folder update task. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -687,18 +666,6 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -757,6 +724,19 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\FolderActionResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -811,9 +791,9 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se /** * Operation checkUpdateStatusAsync * - * Check folder update status. + * Check folder update status * - * @param string $task_id TaskId of folder update (required) + * @param string $task_id The ID of the folder update task. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -832,9 +812,9 @@ function ($response) { /** * Operation checkUpdateStatusAsyncWithHttpInfo * - * Check folder update status. + * Check folder update status * - * @param string $task_id TaskId of folder update (required) + * @param string $task_id The ID of the folder update task. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -884,7 +864,7 @@ function ($exception) { /** * Create request for operation 'checkUpdateStatus' * - * @param string $task_id TaskId of folder update (required) + * @param string $task_id The ID of the folder update task. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -980,7 +960,7 @@ public function checkUpdateStatusRequest($task_id, string $contentType = self::c /** * Operation create * - * Create folder. + * Create folder * * @param \HubSpot\Client\Files\Model\FolderInput $folder_input Folder creation options (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -998,7 +978,7 @@ public function create($folder_input, string $contentType = self::contentTypes[' /** * Operation createWithHttpInfo * - * Create folder. + * Create folder * * @param \HubSpot\Client\Files\Model\FolderInput $folder_input Folder creation options (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -1033,18 +1013,6 @@ public function createWithHttpInfo($folder_input, string $contentType = self::co $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -1103,6 +1071,19 @@ public function createWithHttpInfo($folder_input, string $contentType = self::co ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\Folder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1157,7 +1138,7 @@ public function createWithHttpInfo($folder_input, string $contentType = self::co /** * Operation createAsync * - * Create folder. + * Create folder * * @param \HubSpot\Client\Files\Model\FolderInput $folder_input Folder creation options (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -1178,7 +1159,7 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Create folder. + * Create folder * * @param \HubSpot\Client\Files\Model\FolderInput $folder_input Folder creation options (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation @@ -1327,30 +1308,32 @@ public function createRequest($folder_input, string $contentType = self::content * * Search folders * - * @param string[] $properties Properties that should be included in the returned folders. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before before (optional) - * @param int $limit Limit of results to return. Max limit is 100. (optional) - * @param string[] $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param string $id Search folder by given ID. (optional) - * @param \DateTime $created_at Search for folders with the given creation timestamp. (optional) - * @param \DateTime $created_at_lte created_at_lte (optional) - * @param \DateTime $created_at_gte created_at_gte (optional) - * @param \DateTime $updated_at Search for folder at given update timestamp. (optional) - * @param \DateTime $updated_at_lte updated_at_lte (optional) - * @param \DateTime $updated_at_gte updated_at_gte (optional) - * @param string $name Search for folders containing the specified name. (optional) - * @param string $path Search for folders by path. (optional) - * @param int $parent_folder_id Search for folders with the given parent folderId. (optional) + * @param string[]|null $properties Properties that should be included in the returned folders. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search folders by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search folders by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) + * @param string|null $name Search for folders containing the specified name. (optional) + * @param string|null $path Search folders by path. (optional) + * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) * @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\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Files\Model\CollectionResponseFolder|\HubSpot\Client\Files\Model\Error */ - public function doSearch($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearch($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $contentType); + list($response) = $this->doSearchWithHttpInfo($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $contentType); return $response; } @@ -1359,30 +1342,32 @@ public function doSearch($properties = null, $after = null, $before = null, $lim * * Search folders * - * @param string[] $properties Properties that should be included in the returned folders. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Limit of results to return. Max limit is 100. (optional) - * @param string[] $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param string $id Search folder by given ID. (optional) - * @param \DateTime $created_at Search for folders with the given creation timestamp. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search for folder at given update timestamp. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for folders containing the specified name. (optional) - * @param string $path Search for folders by path. (optional) - * @param int $parent_folder_id Search for folders with the given parent folderId. (optional) + * @param string[]|null $properties Properties that should be included in the returned folders. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search folders by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search folders by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) + * @param string|null $name Search for folders containing the specified name. (optional) + * @param string|null $path Search folders by path. (optional) + * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) * @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\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Files\Model\CollectionResponseFolder|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $contentType); + $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $contentType); try { $options = $this->createHttpClientOption(); @@ -1406,18 +1391,6 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1476,6 +1449,19 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\CollectionResponseFolder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1532,29 +1518,31 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before * * Search folders * - * @param string[] $properties Properties that should be included in the returned folders. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Limit of results to return. Max limit is 100. (optional) - * @param string[] $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param string $id Search folder by given ID. (optional) - * @param \DateTime $created_at Search for folders with the given creation timestamp. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search for folder at given update timestamp. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for folders containing the specified name. (optional) - * @param string $path Search for folders by path. (optional) - * @param int $parent_folder_id Search for folders with the given parent folderId. (optional) + * @param string[]|null $properties Properties that should be included in the returned folders. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search folders by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search folders by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) + * @param string|null $name Search for folders containing the specified name. (optional) + * @param string|null $path Search folders by path. (optional) + * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchAsync($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $contentType) + return $this->doSearchAsyncWithHttpInfo($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $contentType) ->then( function ($response) { return $response[0]; @@ -1567,30 +1555,32 @@ function ($response) { * * Search folders * - * @param string[] $properties Properties that should be included in the returned folders. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Limit of results to return. Max limit is 100. (optional) - * @param string[] $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param string $id Search folder by given ID. (optional) - * @param \DateTime $created_at Search for folders with the given creation timestamp. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search for folder at given update timestamp. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for folders containing the specified name. (optional) - * @param string $path Search for folders by path. (optional) - * @param int $parent_folder_id Search for folders with the given parent folderId. (optional) + * @param string[]|null $properties Properties that should be included in the returned folders. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search folders by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search folders by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) + * @param string|null $name Search for folders containing the specified name. (optional) + * @param string|null $path Search folders by path. (optional) + * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchAsyncWithHttpInfo($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Files\Model\CollectionResponseFolder'; - $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $id, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_id, $contentType); + $request = $this->doSearchRequest($properties, $after, $before, $limit, $sort, $ids, $id_lte, $id_gte, $created_at, $created_at_lte, $created_at_gte, $updated_at, $updated_at_lte, $updated_at_gte, $name, $path, $parent_folder_ids, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,27 +1621,29 @@ function ($exception) { /** * Create request for operation 'doSearch' * - * @param string[] $properties Properties that should be included in the returned folders. (optional) - * @param string $after The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit. (optional) - * @param string $before (optional) - * @param int $limit Limit of results to return. Max limit is 100. (optional) - * @param string[] $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param string $id Search folder by given ID. (optional) - * @param \DateTime $created_at Search for folders with the given creation timestamp. (optional) - * @param \DateTime $created_at_lte (optional) - * @param \DateTime $created_at_gte (optional) - * @param \DateTime $updated_at Search for folder at given update timestamp. (optional) - * @param \DateTime $updated_at_lte (optional) - * @param \DateTime $updated_at_gte (optional) - * @param string $name Search for folders containing the specified name. (optional) - * @param string $path Search for folders by path. (optional) - * @param int $parent_folder_id Search for folders with the given parent folderId. (optional) + * @param string[]|null $properties Properties that should be included in the returned folders. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before (optional) + * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) + * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte (optional) + * @param int|null $id_gte (optional) + * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search folders by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search folders by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) + * @param string|null $name Search for folders containing the specified name. (optional) + * @param string|null $path Search folders by path. (optional) + * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($properties = null, $after = null, $before = null, $limit = null, $sort = null, $id = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_id = null, string $contentType = self::contentTypes['doSearch'][0]) + public function doSearchRequest($properties = null, $after = null, $before = null, $limit = null, $sort = null, $ids = null, $id_lte = null, $id_gte = null, $created_at = null, $created_at_lte = null, $created_at_gte = null, $updated_at = null, $updated_at_lte = null, $updated_at_gte = null, $name = null, $path = null, $parent_folder_ids = null, string $contentType = self::contentTypes['doSearch'][0]) { @@ -1670,6 +1662,8 @@ public function doSearchRequest($properties = null, $after = null, $before = nul + + $resourcePath = '/files/v3/folders/search'; $formParams = []; $queryParams = []; @@ -1724,9 +1718,27 @@ public function doSearchRequest($properties = null, $after = null, $before = nul ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $id, - 'id', // param base name - 'string', // openApiType + $ids, + 'ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_lte, + 'idLte', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $id_gte, + 'idGte', // param base name + 'integer', // openApiType 'form', // style true, // explode false // required @@ -1805,9 +1817,9 @@ public function doSearchRequest($properties = null, $after = null, $before = nul ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $parent_folder_id, - 'parentFolderId', // param base name - 'integer', // openApiType + $parent_folder_ids, + 'parentFolderIds', // param base name + 'array', // openApiType 'form', // style true, // explode false // required @@ -1876,10 +1888,10 @@ public function doSearchRequest($properties = null, $after = null, $before = nul /** * Operation getById * - * Get folder + * Retrieve folder by ID * * @param string $folder_id ID of desired folder (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1895,10 +1907,10 @@ public function getById($folder_id, $properties = null, string $contentType = se /** * Operation getByIdWithHttpInfo * - * Get folder + * Retrieve folder by ID * * @param string $folder_id ID of desired folder (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1931,18 +1943,6 @@ public function getByIdWithHttpInfo($folder_id, $properties = null, string $cont $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2001,6 +2001,19 @@ public function getByIdWithHttpInfo($folder_id, $properties = null, string $cont ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\Folder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2055,10 +2068,10 @@ public function getByIdWithHttpInfo($folder_id, $properties = null, string $cont /** * Operation getByIdAsync * - * Get folder + * Retrieve folder by ID * * @param string $folder_id ID of desired folder (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2077,10 +2090,10 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Get folder + * Retrieve folder by ID * * @param string $folder_id ID of desired folder (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2131,7 +2144,7 @@ function ($exception) { * Create request for operation 'getById' * * @param string $folder_id ID of desired folder (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2240,10 +2253,10 @@ public function getByIdRequest($folder_id, $properties = null, string $contentTy /** * Operation getByPath * - * Get folder. + * Retrieve folder by path * * @param string $folder_path Path of desired folder. (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByPath'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2259,10 +2272,10 @@ public function getByPath($folder_path, $properties = null, string $contentType /** * Operation getByPathWithHttpInfo * - * Get folder. + * Retrieve folder by path * * @param string $folder_path Path of desired folder. (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByPath'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2295,18 +2308,6 @@ public function getByPathWithHttpInfo($folder_path, $properties = null, string $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2365,6 +2366,19 @@ public function getByPathWithHttpInfo($folder_path, $properties = null, string $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Files\Model\Folder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -2419,10 +2433,10 @@ public function getByPathWithHttpInfo($folder_path, $properties = null, string $ /** * Operation getByPathAsync * - * Get folder. + * Retrieve folder by path * * @param string $folder_path Path of desired folder. (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByPath'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2441,10 +2455,10 @@ function ($response) { /** * Operation getByPathAsyncWithHttpInfo * - * Get folder. + * Retrieve folder by path * * @param string $folder_path Path of desired folder. (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByPath'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2495,7 +2509,7 @@ function ($exception) { * Create request for operation 'getByPath' * * @param string $folder_path Path of desired folder. (required) - * @param string[] $properties Properties to set on returned folder. (optional) + * @param string[]|null $properties Properties to set on returned folder. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByPath'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2604,36 +2618,38 @@ public function getByPathRequest($folder_path, $properties = null, string $conte /** * Operation updateProperties * - * Update folder properties + * Update folder properties by folder ID * - * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input Properties to change in the folder (required) + * @param string $folder_id ID of folder to update (required) + * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input folder_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Files\Model\FolderUpdateTaskLocator|\HubSpot\Client\Files\Model\Error + * @return \HubSpot\Client\Files\Model\Folder|\HubSpot\Client\Files\Model\Error */ - public function updateProperties($folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) + public function updateProperties($folder_id, $folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) { - list($response) = $this->updatePropertiesWithHttpInfo($folder_update_input, $contentType); + list($response) = $this->updatePropertiesWithHttpInfo($folder_id, $folder_update_input, $contentType); return $response; } /** * Operation updatePropertiesWithHttpInfo * - * Update folder properties + * Update folder properties by folder ID * - * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input Properties to change in the folder (required) + * @param string $folder_id ID of folder to update (required) + * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Files\Model\FolderUpdateTaskLocator|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Files\Model\Folder|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updatePropertiesWithHttpInfo($folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) + public function updatePropertiesWithHttpInfo($folder_id, $folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) { - $request = $this->updatePropertiesRequest($folder_update_input, $contentType); + $request = $this->updatePropertiesRequest($folder_id, $folder_update_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -2657,26 +2673,14 @@ public function updatePropertiesWithHttpInfo($folder_update_input, string $conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { - case 202: - if ('\HubSpot\Client\Files\Model\FolderUpdateTaskLocator' === '\SplFileObject') { + case 200: + if ('\HubSpot\Client\Files\Model\Folder' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\FolderUpdateTaskLocator' !== 'string') { + if ('\HubSpot\Client\Files\Model\Folder' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -2694,7 +2698,7 @@ public function updatePropertiesWithHttpInfo($folder_update_input, string $conte } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Files\Model\Folder', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2727,7 +2731,20 @@ public function updatePropertiesWithHttpInfo($folder_update_input, string $conte ]; } - $returnType = '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Files\Model\Folder'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -2757,10 +2774,10 @@ public function updatePropertiesWithHttpInfo($folder_update_input, string $conte } catch (ApiException $e) { switch ($e->getCode()) { - case 202: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator', + '\HubSpot\Client\Files\Model\Folder', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2781,17 +2798,18 @@ public function updatePropertiesWithHttpInfo($folder_update_input, string $conte /** * Operation updatePropertiesAsync * - * Update folder properties + * Update folder properties by folder ID * - * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input Properties to change in the folder (required) + * @param string $folder_id ID of folder to update (required) + * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePropertiesAsync($folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) + public function updatePropertiesAsync($folder_id, $folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) { - return $this->updatePropertiesAsyncWithHttpInfo($folder_update_input, $contentType) + return $this->updatePropertiesAsyncWithHttpInfo($folder_id, $folder_update_input, $contentType) ->then( function ($response) { return $response[0]; @@ -2802,18 +2820,19 @@ function ($response) { /** * Operation updatePropertiesAsyncWithHttpInfo * - * Update folder properties + * Update folder properties by folder ID * - * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input Properties to change in the folder (required) + * @param string $folder_id ID of folder to update (required) + * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePropertiesAsyncWithHttpInfo($folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) + public function updatePropertiesAsyncWithHttpInfo($folder_id, $folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) { - $returnType = '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator'; - $request = $this->updatePropertiesRequest($folder_update_input, $contentType); + $returnType = '\HubSpot\Client\Files\Model\Folder'; + $request = $this->updatePropertiesRequest($folder_id, $folder_update_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2854,15 +2873,26 @@ function ($exception) { /** * Create request for operation 'updateProperties' * - * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input Properties to change in the folder (required) + * @param string $folder_id ID of folder to update (required) + * @param \HubSpot\Client\Files\Model\FolderUpdateInput $folder_update_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProperties'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updatePropertiesRequest($folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) + public function updatePropertiesRequest($folder_id, $folder_update_input, string $contentType = self::contentTypes['updateProperties'][0]) { + // verify the required parameter 'folder_id' is set + if ($folder_id === null || (is_array($folder_id) && count($folder_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $folder_id when calling updateProperties' + ); + } + if (!preg_match("/\\d+/", $folder_id)) { + throw new \InvalidArgumentException("invalid value for \"folder_id\" when calling FoldersApi.updateProperties, must conform to the pattern /\\d+/."); + } + // verify the required parameter 'folder_update_input' is set if ($folder_update_input === null || (is_array($folder_update_input) && count($folder_update_input) === 0)) { throw new \InvalidArgumentException( @@ -2871,7 +2901,7 @@ public function updatePropertiesRequest($folder_update_input, string $contentTyp } - $resourcePath = '/files/v3/folders/update/async'; + $resourcePath = '/files/v3/folders/{folderId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2880,6 +2910,14 @@ public function updatePropertiesRequest($folder_update_input, string $contentTyp + // path params + if ($folder_id !== null) { + $resourcePath = str_replace( + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folder_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -2936,6 +2974,352 @@ public function updatePropertiesRequest($folder_update_input, string $contentTyp $headers ); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updatePropertiesRecursively + * + * Update folder properties + * + * @param \HubSpot\Client\Files\Model\FolderUpdateInputWithId $folder_update_input_with_id folder_update_input_with_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePropertiesRecursively'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Files\Model\FolderUpdateTaskLocator|\HubSpot\Client\Files\Model\Error + */ + public function updatePropertiesRecursively($folder_update_input_with_id, string $contentType = self::contentTypes['updatePropertiesRecursively'][0]) + { + list($response) = $this->updatePropertiesRecursivelyWithHttpInfo($folder_update_input_with_id, $contentType); + return $response; + } + + /** + * Operation updatePropertiesRecursivelyWithHttpInfo + * + * Update folder properties + * + * @param \HubSpot\Client\Files\Model\FolderUpdateInputWithId $folder_update_input_with_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePropertiesRecursively'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Files\Model\FolderUpdateTaskLocator|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updatePropertiesRecursivelyWithHttpInfo($folder_update_input_with_id, string $contentType = self::contentTypes['updatePropertiesRecursively'][0]) + { + $request = $this->updatePropertiesRecursivelyRequest($folder_update_input_with_id, $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 202: + if ('\HubSpot\Client\Files\Model\FolderUpdateTaskLocator' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Files\Model\FolderUpdateTaskLocator' !== '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\Files\Model\FolderUpdateTaskLocator', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Files\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\Files\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Files\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updatePropertiesRecursivelyAsync + * + * Update folder properties + * + * @param \HubSpot\Client\Files\Model\FolderUpdateInputWithId $folder_update_input_with_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePropertiesRecursively'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePropertiesRecursivelyAsync($folder_update_input_with_id, string $contentType = self::contentTypes['updatePropertiesRecursively'][0]) + { + return $this->updatePropertiesRecursivelyAsyncWithHttpInfo($folder_update_input_with_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePropertiesRecursivelyAsyncWithHttpInfo + * + * Update folder properties + * + * @param \HubSpot\Client\Files\Model\FolderUpdateInputWithId $folder_update_input_with_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePropertiesRecursively'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePropertiesRecursivelyAsyncWithHttpInfo($folder_update_input_with_id, string $contentType = self::contentTypes['updatePropertiesRecursively'][0]) + { + $returnType = '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator'; + $request = $this->updatePropertiesRecursivelyRequest($folder_update_input_with_id, $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 'updatePropertiesRecursively' + * + * @param \HubSpot\Client\Files\Model\FolderUpdateInputWithId $folder_update_input_with_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePropertiesRecursively'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updatePropertiesRecursivelyRequest($folder_update_input_with_id, string $contentType = self::contentTypes['updatePropertiesRecursively'][0]) + { + + // verify the required parameter 'folder_update_input_with_id' is set + if ($folder_update_input_with_id === null || (is_array($folder_update_input_with_id) && count($folder_update_input_with_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $folder_update_input_with_id when calling updatePropertiesRecursively' + ); + } + + + $resourcePath = '/files/v3/folders/update/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($folder_update_input_with_id)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($folder_update_input_with_id)); + } else { + $httpBody = $folder_update_input_with_id; + } + } elseif (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( diff --git a/codegen/Files/ApiException.php b/codegen/Files/ApiException.php index 454789682..6501552a2 100644 --- a/codegen/Files/ApiException.php +++ b/codegen/Files/ApiException.php @@ -10,13 +10,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Files/Configuration.php b/codegen/Files/Configuration.php index ffcbf3576..135d14591 100644 --- a/codegen/Files/Configuration.php +++ b/codegen/Files/Configuration.php @@ -10,13 +10,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Files/HeaderSelector.php b/codegen/Files/HeaderSelector.php index 34906df49..c5e265986 100644 --- a/codegen/Files/HeaderSelector.php +++ b/codegen/Files/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Files/Model/CollectionResponseFile.php b/codegen/Files/Model/CollectionResponseFile.php index afba8dae8..dfcf71f00 100644 --- a/codegen/Files/Model/CollectionResponseFile.php +++ b/codegen/Files/Model/CollectionResponseFile.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Files/Model/CollectionResponseFolder.php b/codegen/Files/Model/CollectionResponseFolder.php index 6450853fb..f28ef54d1 100644 --- a/codegen/Files/Model/CollectionResponseFolder.php +++ b/codegen/Files/Model/CollectionResponseFolder.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Files/Model/Error.php b/codegen/Files/Model/Error.php index f956fa493..f4a23547a 100644 --- a/codegen/Files/Model/Error.php +++ b/codegen/Files/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Files/Model/ErrorDetail.php b/codegen/Files/Model/ErrorDetail.php index 43ad3441f..673e5d1d0 100644 --- a/codegen/Files/Model/ErrorDetail.php +++ b/codegen/Files/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Files/Model/File.php b/codegen/Files/Model/File.php index c8898f3ae..915866c24 100644 --- a/codegen/Files/Model/File.php +++ b/codegen/Files/Model/File.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -61,6 +61,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable 'extension' => 'string', 'access' => 'string', 'parent_folder_id' => 'string', + 'source_group' => 'string', + 'file_md5' => 'string', 'encoding' => 'string', 'type' => 'string', 'is_usable_in_content' => 'bool', @@ -68,8 +70,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable 'expires_at' => 'int', 'created_at' => '\DateTime', 'archived_at' => '\DateTime', - 'archived' => 'bool', 'path' => 'string', + 'archived' => 'bool', 'size' => 'int', 'name' => 'string', 'width' => 'int', @@ -90,6 +92,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable 'extension' => null, 'access' => null, 'parent_folder_id' => null, + 'source_group' => null, + 'file_md5' => null, 'encoding' => null, 'type' => null, 'is_usable_in_content' => null, @@ -97,8 +101,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable 'expires_at' => 'int64', 'created_at' => 'date-time', 'archived_at' => 'date-time', - 'archived' => null, 'path' => null, + 'archived' => null, 'size' => 'int64', 'name' => null, 'width' => 'int32', @@ -117,6 +121,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable 'extension' => false, 'access' => false, 'parent_folder_id' => false, + 'source_group' => false, + 'file_md5' => false, 'encoding' => false, 'type' => false, 'is_usable_in_content' => false, @@ -124,8 +130,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable 'expires_at' => false, 'created_at' => false, 'archived_at' => false, - 'archived' => false, 'path' => false, + 'archived' => false, 'size' => false, 'name' => false, 'width' => false, @@ -224,6 +230,8 @@ public function isNullableSetToNull(string $property): bool 'extension' => 'extension', 'access' => 'access', 'parent_folder_id' => 'parentFolderId', + 'source_group' => 'sourceGroup', + 'file_md5' => 'fileMd5', 'encoding' => 'encoding', 'type' => 'type', 'is_usable_in_content' => 'isUsableInContent', @@ -231,8 +239,8 @@ public function isNullableSetToNull(string $property): bool 'expires_at' => 'expiresAt', 'created_at' => 'createdAt', 'archived_at' => 'archivedAt', - 'archived' => 'archived', 'path' => 'path', + 'archived' => 'archived', 'size' => 'size', 'name' => 'name', 'width' => 'width', @@ -251,6 +259,8 @@ public function isNullableSetToNull(string $property): bool 'extension' => 'setExtension', 'access' => 'setAccess', 'parent_folder_id' => 'setParentFolderId', + 'source_group' => 'setSourceGroup', + 'file_md5' => 'setFileMd5', 'encoding' => 'setEncoding', 'type' => 'setType', 'is_usable_in_content' => 'setIsUsableInContent', @@ -258,8 +268,8 @@ public function isNullableSetToNull(string $property): bool 'expires_at' => 'setExpiresAt', 'created_at' => 'setCreatedAt', 'archived_at' => 'setArchivedAt', - 'archived' => 'setArchived', 'path' => 'setPath', + 'archived' => 'setArchived', 'size' => 'setSize', 'name' => 'setName', 'width' => 'setWidth', @@ -278,6 +288,8 @@ public function isNullableSetToNull(string $property): bool 'extension' => 'getExtension', 'access' => 'getAccess', 'parent_folder_id' => 'getParentFolderId', + 'source_group' => 'getSourceGroup', + 'file_md5' => 'getFileMd5', 'encoding' => 'getEncoding', 'type' => 'getType', 'is_usable_in_content' => 'getIsUsableInContent', @@ -285,8 +297,8 @@ public function isNullableSetToNull(string $property): bool 'expires_at' => 'getExpiresAt', 'created_at' => 'getCreatedAt', 'archived_at' => 'getArchivedAt', - 'archived' => 'getArchived', 'path' => 'getPath', + 'archived' => 'getArchived', 'size' => 'getSize', 'name' => 'getName', 'width' => 'getWidth', @@ -343,6 +355,8 @@ public function getModelName() public const ACCESS_HIDDEN_NOT_INDEXABLE = 'HIDDEN_NOT_INDEXABLE'; public const ACCESS_HIDDEN_PRIVATE = 'HIDDEN_PRIVATE'; public const ACCESS__PRIVATE = 'PRIVATE'; + public const ACCESS_HIDDEN_SENSITIVE = 'HIDDEN_SENSITIVE'; + public const ACCESS_SENSITIVE = 'SENSITIVE'; /** * Gets allowable values of the enum @@ -358,6 +372,8 @@ public function getAccessAllowableValues() self::ACCESS_HIDDEN_NOT_INDEXABLE, self::ACCESS_HIDDEN_PRIVATE, self::ACCESS__PRIVATE, + self::ACCESS_HIDDEN_SENSITIVE, + self::ACCESS_SENSITIVE, ]; } @@ -371,14 +387,16 @@ public function getAccessAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('extension', $data ?? [], null); $this->setIfExists('access', $data ?? [], null); $this->setIfExists('parent_folder_id', $data ?? [], null); + $this->setIfExists('source_group', $data ?? [], null); + $this->setIfExists('file_md5', $data ?? [], null); $this->setIfExists('encoding', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); $this->setIfExists('is_usable_in_content', $data ?? [], null); @@ -386,8 +404,8 @@ public function __construct(array $data = null) $this->setIfExists('expires_at', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); - $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('size', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('width', $data ?? [], null); @@ -554,6 +572,60 @@ public function setParentFolderId($parent_folder_id) return $this; } + /** + * Gets source_group + * + * @return string|null + */ + public function getSourceGroup() + { + return $this->container['source_group']; + } + + /** + * Sets source_group + * + * @param string|null $source_group source_group + * + * @return self + */ + public function setSourceGroup($source_group) + { + if (is_null($source_group)) { + throw new \InvalidArgumentException('non-nullable source_group cannot be null'); + } + $this->container['source_group'] = $source_group; + + return $this; + } + + /** + * Gets file_md5 + * + * @return string|null + */ + public function getFileMd5() + { + return $this->container['file_md5']; + } + + /** + * Sets file_md5 + * + * @param string|null $file_md5 file_md5 + * + * @return self + */ + public function setFileMd5($file_md5) + { + if (is_null($file_md5)) { + throw new \InvalidArgumentException('non-nullable file_md5 cannot be null'); + } + $this->container['file_md5'] = $file_md5; + + return $this; + } + /** * Gets encoding * @@ -744,55 +816,55 @@ public function setArchivedAt($archived_at) } /** - * Gets archived + * Gets path * - * @return bool + * @return string|null */ - public function getArchived() + public function getPath() { - return $this->container['archived']; + return $this->container['path']; } /** - * Sets archived + * Sets path * - * @param bool $archived If the file is deleted. + * @param string|null $path Path of the file in the file manager. * * @return self */ - public function setArchived($archived) + public function setPath($path) { - if (is_null($archived)) { - throw new \InvalidArgumentException('non-nullable archived cannot be null'); + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); } - $this->container['archived'] = $archived; + $this->container['path'] = $path; return $this; } /** - * Gets path + * Gets archived * - * @return string|null + * @return bool */ - public function getPath() + public function getArchived() { - return $this->container['path']; + return $this->container['archived']; } /** - * Sets path + * Sets archived * - * @param string|null $path Path of the file in the file manager. + * @param bool $archived If the file is deleted. * * @return self */ - public function setPath($path) + public function setArchived($archived) { - if (is_null($path)) { - throw new \InvalidArgumentException('non-nullable path cannot be null'); + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); } - $this->container['path'] = $path; + $this->container['archived'] = $archived; return $this; } diff --git a/codegen/Files/Model/FileActionResponse.php b/codegen/Files/Model/FileActionResponse.php index 71cce8cbd..6f065bf19 100644 --- a/codegen/Files/Model/FileActionResponse.php +++ b/codegen/Files/Model/FileActionResponse.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -306,10 +306,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('result', $data ?? [], null); $this->setIfExists('completed_at', $data ?? [], null); diff --git a/codegen/Files/Model/FileStat.php b/codegen/Files/Model/FileStat.php index 786318a7e..982faeb6e 100644 --- a/codegen/Files/Model/FileStat.php +++ b/codegen/Files/Model/FileStat.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('file', $data ?? [], null); $this->setIfExists('folder', $data ?? [], null); diff --git a/codegen/Files/Model/FileUpdateInput.php b/codegen/Files/Model/FileUpdateInput.php index 03d415efc..1cd78760c 100644 --- a/codegen/Files/Model/FileUpdateInput.php +++ b/codegen/Files/Model/FileUpdateInput.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,8 +62,9 @@ class FileUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializable 'parent_folder_id' => 'string', 'name' => 'string', 'parent_folder_path' => 'string', + 'clear_expires' => 'bool', 'is_usable_in_content' => 'bool', - 'expires_at' => 'int' + 'expires_at' => '\DateTime' ]; /** @@ -78,8 +79,9 @@ class FileUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializable 'parent_folder_id' => null, 'name' => null, 'parent_folder_path' => null, + 'clear_expires' => null, 'is_usable_in_content' => null, - 'expires_at' => 'int64' + 'expires_at' => 'date-time' ]; /** @@ -92,6 +94,7 @@ class FileUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializable 'parent_folder_id' => false, 'name' => false, 'parent_folder_path' => false, + 'clear_expires' => false, 'is_usable_in_content' => false, 'expires_at' => false ]; @@ -186,6 +189,7 @@ public function isNullableSetToNull(string $property): bool 'parent_folder_id' => 'parentFolderId', 'name' => 'name', 'parent_folder_path' => 'parentFolderPath', + 'clear_expires' => 'clearExpires', 'is_usable_in_content' => 'isUsableInContent', 'expires_at' => 'expiresAt' ]; @@ -200,6 +204,7 @@ public function isNullableSetToNull(string $property): bool 'parent_folder_id' => 'setParentFolderId', 'name' => 'setName', 'parent_folder_path' => 'setParentFolderPath', + 'clear_expires' => 'setClearExpires', 'is_usable_in_content' => 'setIsUsableInContent', 'expires_at' => 'setExpiresAt' ]; @@ -214,6 +219,7 @@ public function isNullableSetToNull(string $property): bool 'parent_folder_id' => 'getParentFolderId', 'name' => 'getName', 'parent_folder_path' => 'getParentFolderPath', + 'clear_expires' => 'getClearExpires', 'is_usable_in_content' => 'getIsUsableInContent', 'expires_at' => 'getExpiresAt' ]; @@ -265,6 +271,8 @@ public function getModelName() public const ACCESS_HIDDEN_NOT_INDEXABLE = 'HIDDEN_NOT_INDEXABLE'; public const ACCESS_HIDDEN_PRIVATE = 'HIDDEN_PRIVATE'; public const ACCESS__PRIVATE = 'PRIVATE'; + public const ACCESS_HIDDEN_SENSITIVE = 'HIDDEN_SENSITIVE'; + public const ACCESS_SENSITIVE = 'SENSITIVE'; /** * Gets allowable values of the enum @@ -280,6 +288,8 @@ public function getAccessAllowableValues() self::ACCESS_HIDDEN_NOT_INDEXABLE, self::ACCESS_HIDDEN_PRIVATE, self::ACCESS__PRIVATE, + self::ACCESS_HIDDEN_SENSITIVE, + self::ACCESS_SENSITIVE, ]; } @@ -293,15 +303,16 @@ public function getAccessAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('access', $data ?? [], null); $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('parent_folder_path', $data ?? [], null); + $this->setIfExists('clear_expires', $data ?? [], null); $this->setIfExists('is_usable_in_content', $data ?? [], null); $this->setIfExists('expires_at', $data ?? [], null); } @@ -475,6 +486,33 @@ public function setParentFolderPath($parent_folder_path) return $this; } + /** + * Gets clear_expires + * + * @return bool|null + */ + public function getClearExpires() + { + return $this->container['clear_expires']; + } + + /** + * Sets clear_expires + * + * @param bool|null $clear_expires clear_expires + * + * @return self + */ + public function setClearExpires($clear_expires) + { + if (is_null($clear_expires)) { + throw new \InvalidArgumentException('non-nullable clear_expires cannot be null'); + } + $this->container['clear_expires'] = $clear_expires; + + return $this; + } + /** * Gets is_usable_in_content * @@ -505,7 +543,7 @@ public function setIsUsableInContent($is_usable_in_content) /** * Gets expires_at * - * @return int|null + * @return \DateTime|null */ public function getExpiresAt() { @@ -515,7 +553,7 @@ public function getExpiresAt() /** * Sets expires_at * - * @param int|null $expires_at expires_at + * @param \DateTime|null $expires_at expires_at * * @return self */ diff --git a/codegen/Files/Model/Folder.php b/codegen/Files/Model/Folder.php index f9d1b4b73..a9867fd07 100644 --- a/codegen/Files/Model/Folder.php +++ b/codegen/Files/Model/Folder.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -59,8 +59,8 @@ class Folder implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'created_at' => '\DateTime', 'archived_at' => '\DateTime', - 'archived' => 'bool', 'path' => 'string', + 'archived' => 'bool', 'parent_folder_id' => 'string', 'name' => 'string', 'id' => 'string', @@ -77,8 +77,8 @@ class Folder implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'created_at' => 'date-time', 'archived_at' => 'date-time', - 'archived' => null, 'path' => null, + 'archived' => null, 'parent_folder_id' => null, 'name' => null, 'id' => null, @@ -93,8 +93,8 @@ class Folder implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'created_at' => false, 'archived_at' => false, - 'archived' => false, 'path' => false, + 'archived' => false, 'parent_folder_id' => false, 'name' => false, 'id' => false, @@ -189,8 +189,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'created_at' => 'createdAt', 'archived_at' => 'archivedAt', - 'archived' => 'archived', 'path' => 'path', + 'archived' => 'archived', 'parent_folder_id' => 'parentFolderId', 'name' => 'name', 'id' => 'id', @@ -205,8 +205,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'created_at' => 'setCreatedAt', 'archived_at' => 'setArchivedAt', - 'archived' => 'setArchived', 'path' => 'setPath', + 'archived' => 'setArchived', 'parent_folder_id' => 'setParentFolderId', 'name' => 'setName', 'id' => 'setId', @@ -221,8 +221,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'created_at' => 'getCreatedAt', 'archived_at' => 'getArchivedAt', - 'archived' => 'getArchived', 'path' => 'getPath', + 'archived' => 'getArchived', 'parent_folder_id' => 'getParentFolderId', 'name' => 'getName', 'id' => 'getId', @@ -281,15 +281,15 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); - $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('path', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); @@ -405,55 +405,55 @@ public function setArchivedAt($archived_at) } /** - * Gets archived + * Gets path * - * @return bool + * @return string|null */ - public function getArchived() + public function getPath() { - return $this->container['archived']; + return $this->container['path']; } /** - * Sets archived + * Sets path * - * @param bool $archived Marks whether the folder is deleted or not. + * @param string|null $path Path of the folder in the file manager. * * @return self */ - public function setArchived($archived) + public function setPath($path) { - if (is_null($archived)) { - throw new \InvalidArgumentException('non-nullable archived cannot be null'); + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); } - $this->container['archived'] = $archived; + $this->container['path'] = $path; return $this; } /** - * Gets path + * Gets archived * - * @return string|null + * @return bool */ - public function getPath() + public function getArchived() { - return $this->container['path']; + return $this->container['archived']; } /** - * Sets path + * Sets archived * - * @param string|null $path Path of the folder in the file manager. + * @param bool $archived Marks whether the folder is deleted or not. * * @return self */ - public function setPath($path) + public function setArchived($archived) { - if (is_null($path)) { - throw new \InvalidArgumentException('non-nullable path cannot be null'); + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); } - $this->container['path'] = $path; + $this->container['archived'] = $archived; return $this; } diff --git a/codegen/Files/Model/FolderActionResponse.php b/codegen/Files/Model/FolderActionResponse.php index e49b5b4fa..89b2d4f9d 100644 --- a/codegen/Files/Model/FolderActionResponse.php +++ b/codegen/Files/Model/FolderActionResponse.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -306,10 +306,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('result', $data ?? [], null); $this->setIfExists('completed_at', $data ?? [], null); diff --git a/codegen/Files/Model/FolderInput.php b/codegen/Files/Model/FolderInput.php index 900ee67c9..cf79ce1ca 100644 --- a/codegen/Files/Model/FolderInput.php +++ b/codegen/Files/Model/FolderInput.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('parent_path', $data ?? [], null); diff --git a/codegen/Files/Model/FolderUpdateInput.php b/codegen/Files/Model/FolderUpdateInput.php index cadcbc780..c9769eaf8 100644 --- a/codegen/Files/Model/FolderUpdateInput.php +++ b/codegen/Files/Model/FolderUpdateInput.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -59,8 +59,7 @@ class FolderUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static $openAPITypes = [ 'parent_folder_id' => 'int', - 'name' => 'string', - 'id' => 'string' + 'name' => 'string' ]; /** @@ -72,8 +71,7 @@ class FolderUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static $openAPIFormats = [ 'parent_folder_id' => 'int64', - 'name' => null, - 'id' => null + 'name' => null ]; /** @@ -83,8 +81,7 @@ class FolderUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static array $openAPINullables = [ 'parent_folder_id' => false, - 'name' => false, - 'id' => false + 'name' => false ]; /** @@ -174,8 +171,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'parent_folder_id' => 'parentFolderId', - 'name' => 'name', - 'id' => 'id' + 'name' => 'name' ]; /** @@ -185,8 +181,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'parent_folder_id' => 'setParentFolderId', - 'name' => 'setName', - 'id' => 'setId' + 'name' => 'setName' ]; /** @@ -196,8 +191,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'parent_folder_id' => 'getParentFolderId', - 'name' => 'getName', - 'id' => 'getId' + 'name' => 'getName' ]; /** @@ -252,14 +246,13 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); } /** @@ -289,9 +282,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } return $invalidProperties; } @@ -360,33 +350,6 @@ public function setName($name) return $this; } - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id ID of the folder to change. - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Files/Model/FolderUpdateInputWithId.php b/codegen/Files/Model/FolderUpdateInputWithId.php new file mode 100644 index 000000000..7898fec17 --- /dev/null +++ b/codegen/Files/Model/FolderUpdateInputWithId.php @@ -0,0 +1,480 @@ + + */ +class FolderUpdateInputWithId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FolderUpdateInputWithId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'parent_folder_id' => 'int', + 'name' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'parent_folder_id' => 'int64', + 'name' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'parent_folder_id' => false, + 'name' => false, + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'parent_folder_id' => 'parentFolderId', + 'name' => 'name', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'parent_folder_id' => 'setParentFolderId', + 'name' => 'setName', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'parent_folder_id' => 'getParentFolderId', + 'name' => 'getName', + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('parent_folder_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets parent_folder_id + * + * @return int|null + */ + public function getParentFolderId() + { + return $this->container['parent_folder_id']; + } + + /** + * Sets parent_folder_id + * + * @param int|null $parent_folder_id parent_folder_id + * + * @return self + */ + public function setParentFolderId($parent_folder_id) + { + if (is_null($parent_folder_id)) { + throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); + } + $this->container['parent_folder_id'] = $parent_folder_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Files/Model/FolderUpdateTaskLocator.php b/codegen/Files/Model/FolderUpdateTaskLocator.php index 2a7b44007..33310ceef 100644 --- a/codegen/Files/Model/FolderUpdateTaskLocator.php +++ b/codegen/Files/Model/FolderUpdateTaskLocator.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('links', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Files/Model/ImportFromUrlInput.php b/codegen/Files/Model/ImportFromUrlInput.php index e03b3d87a..942eaaf5c 100644 --- a/codegen/Files/Model/ImportFromUrlInput.php +++ b/codegen/Files/Model/ImportFromUrlInput.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -64,6 +64,7 @@ class ImportFromUrlInput implements ModelInterface, ArrayAccess, \JsonSerializab 'duplicate_validation_strategy' => 'string', 'ttl' => 'string', 'overwrite' => 'bool', + 'expires_at' => '\DateTime', 'url' => 'string', 'folder_id' => 'string' ]; @@ -83,6 +84,7 @@ class ImportFromUrlInput implements ModelInterface, ArrayAccess, \JsonSerializab 'duplicate_validation_strategy' => null, 'ttl' => null, 'overwrite' => null, + 'expires_at' => 'date-time', 'url' => null, 'folder_id' => null ]; @@ -100,6 +102,7 @@ class ImportFromUrlInput implements ModelInterface, ArrayAccess, \JsonSerializab 'duplicate_validation_strategy' => false, 'ttl' => false, 'overwrite' => false, + 'expires_at' => false, 'url' => false, 'folder_id' => false ]; @@ -197,6 +200,7 @@ public function isNullableSetToNull(string $property): bool 'duplicate_validation_strategy' => 'duplicateValidationStrategy', 'ttl' => 'ttl', 'overwrite' => 'overwrite', + 'expires_at' => 'expiresAt', 'url' => 'url', 'folder_id' => 'folderId' ]; @@ -214,6 +218,7 @@ public function isNullableSetToNull(string $property): bool 'duplicate_validation_strategy' => 'setDuplicateValidationStrategy', 'ttl' => 'setTtl', 'overwrite' => 'setOverwrite', + 'expires_at' => 'setExpiresAt', 'url' => 'setUrl', 'folder_id' => 'setFolderId' ]; @@ -231,6 +236,7 @@ public function isNullableSetToNull(string $property): bool 'duplicate_validation_strategy' => 'getDuplicateValidationStrategy', 'ttl' => 'getTtl', 'overwrite' => 'getOverwrite', + 'expires_at' => 'getExpiresAt', 'url' => 'getUrl', 'folder_id' => 'getFolderId' ]; @@ -282,6 +288,8 @@ public function getModelName() public const ACCESS_HIDDEN_NOT_INDEXABLE = 'HIDDEN_NOT_INDEXABLE'; public const ACCESS_HIDDEN_PRIVATE = 'HIDDEN_PRIVATE'; public const ACCESS__PRIVATE = 'PRIVATE'; + public const ACCESS_HIDDEN_SENSITIVE = 'HIDDEN_SENSITIVE'; + public const ACCESS_SENSITIVE = 'SENSITIVE'; public const DUPLICATE_VALIDATION_SCOPE_ENTIRE_PORTAL = 'ENTIRE_PORTAL'; public const DUPLICATE_VALIDATION_SCOPE_EXACT_FOLDER = 'EXACT_FOLDER'; public const DUPLICATE_VALIDATION_STRATEGY_NONE = 'NONE'; @@ -302,6 +310,8 @@ public function getAccessAllowableValues() self::ACCESS_HIDDEN_NOT_INDEXABLE, self::ACCESS_HIDDEN_PRIVATE, self::ACCESS__PRIVATE, + self::ACCESS_HIDDEN_SENSITIVE, + self::ACCESS_SENSITIVE, ]; } @@ -342,10 +352,10 @@ public function getDuplicateValidationStrategyAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('folder_path', $data ?? [], null); $this->setIfExists('access', $data ?? [], null); @@ -354,6 +364,7 @@ public function __construct(array $data = null) $this->setIfExists('duplicate_validation_strategy', $data ?? [], null); $this->setIfExists('ttl', $data ?? [], null); $this->setIfExists('overwrite', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); $this->setIfExists('folder_id', $data ?? [], null); } @@ -652,6 +663,33 @@ public function setOverwrite($overwrite) return $this; } + /** + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at expires_at + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** * Gets url * diff --git a/codegen/Files/Model/ImportFromUrlTaskLocator.php b/codegen/Files/Model/ImportFromUrlTaskLocator.php index e77453264..65bd2acc4 100644 --- a/codegen/Files/Model/ImportFromUrlTaskLocator.php +++ b/codegen/Files/Model/ImportFromUrlTaskLocator.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('links', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Files/Model/ModelInterface.php b/codegen/Files/Model/ModelInterface.php index 8b913e839..7d321f067 100644 --- a/codegen/Files/Model/ModelInterface.php +++ b/codegen/Files/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Files/Model/NextPage.php b/codegen/Files/Model/NextPage.php index 411a41da9..f5d250df9 100644 --- a/codegen/Files/Model/NextPage.php +++ b/codegen/Files/Model/NextPage.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Files/Model/Paging.php b/codegen/Files/Model/Paging.php index 751a13918..1a0986d4b 100644 --- a/codegen/Files/Model/Paging.php +++ b/codegen/Files/Model/Paging.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Files/Model/PreviousPage.php b/codegen/Files/Model/PreviousPage.php index b0315e82e..001b56b3a 100644 --- a/codegen/Files/Model/PreviousPage.php +++ b/codegen/Files/Model/PreviousPage.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Files/Model/SignedUrl.php b/codegen/Files/Model/SignedUrl.php index fc8494893..16e963ca9 100644 --- a/codegen/Files/Model/SignedUrl.php +++ b/codegen/Files/Model/SignedUrl.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,8 +63,8 @@ class SignedUrl implements ModelInterface, ArrayAccess, \JsonSerializable 'name' => 'string', 'width' => 'int', 'type' => 'string', - 'expires_at' => '\DateTime', 'url' => 'string', + 'expires_at' => '\DateTime', 'height' => 'int' ]; @@ -77,12 +77,12 @@ class SignedUrl implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'extension' => null, - 'size' => 'int32', + 'size' => 'int64', 'name' => null, 'width' => 'int32', 'type' => null, - 'expires_at' => 'date-time', 'url' => null, + 'expires_at' => 'date-time', 'height' => 'int32' ]; @@ -97,8 +97,8 @@ class SignedUrl implements ModelInterface, ArrayAccess, \JsonSerializable 'name' => false, 'width' => false, 'type' => false, - 'expires_at' => false, 'url' => false, + 'expires_at' => false, 'height' => false ]; @@ -193,8 +193,8 @@ public function isNullableSetToNull(string $property): bool 'name' => 'name', 'width' => 'width', 'type' => 'type', - 'expires_at' => 'expiresAt', 'url' => 'url', + 'expires_at' => 'expiresAt', 'height' => 'height' ]; @@ -209,8 +209,8 @@ public function isNullableSetToNull(string $property): bool 'name' => 'setName', 'width' => 'setWidth', 'type' => 'setType', - 'expires_at' => 'setExpiresAt', 'url' => 'setUrl', + 'expires_at' => 'setExpiresAt', 'height' => 'setHeight' ]; @@ -225,8 +225,8 @@ public function isNullableSetToNull(string $property): bool 'name' => 'getName', 'width' => 'getWidth', 'type' => 'getType', - 'expires_at' => 'getExpiresAt', 'url' => 'getUrl', + 'expires_at' => 'getExpiresAt', 'height' => 'getHeight' ]; @@ -282,18 +282,18 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('extension', $data ?? [], null); $this->setIfExists('size', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('width', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('expires_at', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); $this->setIfExists('height', $data ?? [], null); } @@ -336,12 +336,12 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - if ($this->container['expires_at'] === null) { - $invalidProperties[] = "'expires_at' can't be null"; - } if ($this->container['url'] === null) { $invalidProperties[] = "'url' can't be null"; } + if ($this->container['expires_at'] === null) { + $invalidProperties[] = "'expires_at' can't be null"; + } return $invalidProperties; } @@ -493,55 +493,55 @@ public function setType($type) } /** - * Gets expires_at + * Gets url * - * @return \DateTime + * @return string */ - public function getExpiresAt() + public function getUrl() { - return $this->container['expires_at']; + return $this->container['url']; } /** - * Sets expires_at + * Sets url * - * @param \DateTime $expires_at Timestamp of when the URL will no longer grant access to the file. + * @param string $url Signed URL with access to the specified file. Anyone with this URL will be able to access the file until it expires. * * @return self */ - public function setExpiresAt($expires_at) + public function setUrl($url) { - if (is_null($expires_at)) { - throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); } - $this->container['expires_at'] = $expires_at; + $this->container['url'] = $url; return $this; } /** - * Gets url + * Gets expires_at * - * @return string + * @return \DateTime */ - public function getUrl() + public function getExpiresAt() { - return $this->container['url']; + return $this->container['expires_at']; } /** - * Sets url + * Sets expires_at * - * @param string $url Signed URL with access to the specified file. Anyone with this URL will be able to access the file until it expires. + * @param \DateTime $expires_at Timestamp of when the URL will no longer grant access to the file. * * @return self */ - public function setUrl($url) + public function setExpiresAt($expires_at) { - if (is_null($url)) { - throw new \InvalidArgumentException('non-nullable url cannot be null'); + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); } - $this->container['url'] = $url; + $this->container['expires_at'] = $expires_at; return $this; } diff --git a/codegen/Files/Model/StandardError.php b/codegen/Files/Model/StandardError.php index d536e4f8c..9e895eb74 100644 --- a/codegen/Files/Model/StandardError.php +++ b/codegen/Files/Model/StandardError.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Files/ObjectSerializer.php b/codegen/Files/ObjectSerializer.php index 0c21c7051..53d05ad33 100644 --- a/codegen/Files/ObjectSerializer.php +++ b/codegen/Files/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * Files Files + * Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Marketing/Events/Api/AddEventAttendeesApi.php b/codegen/Marketing/Events/Api/AddEventAttendeesApi.php new file mode 100644 index 000000000..2fff0f275 --- /dev/null +++ b/codegen/Marketing/Events/Api/AddEventAttendeesApi.php @@ -0,0 +1,1726 @@ + [ + 'application/json', + ], + 'recordByContactId' => [ + 'application/json', + ], + 'recordByContactIds' => [ + 'application/json', + ], + 'recordByEmail' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation recordByContactEmails + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByContactEmails($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + list($response) = $this->recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + return $response; + } + + /** + * Operation recordByContactEmailsWithHttpInfo + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $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: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== '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\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByContactEmailsAsync + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactEmailsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + return $this->recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByContactEmailsAsyncWithHttpInfo + * + * Record Participants by Email with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $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 'recordByContactEmails' + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + { + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling recordByContactEmails' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByContactEmails' + ); + } + + // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set + if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling recordByContactEmails' + ); + } + + + + $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/email-create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_account_id, + 'externalAccountId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_email_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_email_subscriber; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation recordByContactId + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByContactId($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + list($response) = $this->recordByContactIdWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $contentType); + return $response; + } + + /** + * Operation recordByContactIdWithHttpInfo + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByContactIdWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + $request = $this->recordByContactIdRequest($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $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: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== '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\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByContactIdAsync + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdAsync($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + return $this->recordByContactIdAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByContactIdAsyncWithHttpInfo + * + * Record Participants by ContactId with Marketing Event Object Id + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + $request = $this->recordByContactIdRequest($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, $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 'recordByContactId' + * + * @param string $object_id The internal id of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByContactIdRequest($object_id, $subscriber_state, $batch_input_marketing_event_subscriber, string $contentType = self::contentTypes['recordByContactId'][0]) + { + + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling recordByContactId' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByContactId' + ); + } + + // verify the required parameter 'batch_input_marketing_event_subscriber' is set + if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_subscriber when calling recordByContactId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/{objectId}/attendance/{subscriberState}/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_subscriber; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation recordByContactIds + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByContactIds($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + list($response) = $this->recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + return $response; + } + + /** + * Operation recordByContactIdsWithHttpInfo + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $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: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== '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\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByContactIdsAsync + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + return $this->recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByContactIdsAsyncWithHttpInfo + * + * Record Participants by ContactId with Marketing Event External Ids + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $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 'recordByContactIds' + * + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) + * @param string|null $external_account_id The accountId that is associated with this marketing event in the external event application (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + { + + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling recordByContactIds' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByContactIds' + ); + } + + // verify the required parameter 'batch_input_marketing_event_subscriber' is set + if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_subscriber when calling recordByContactIds' + ); + } + + + + $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $external_account_id, + 'externalAccountId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_subscriber; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation recordByEmail + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function recordByEmail($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + list($response) = $this->recordByEmailWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $contentType); + return $response; + } + + /** + * Operation recordByEmailWithHttpInfo + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function recordByEmailWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + $request = $this->recordByEmailRequest($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $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: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== '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\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recordByEmailAsync + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByEmailAsync($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + return $this->recordByEmailAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recordByEmailAsyncWithHttpInfo + * + * Record Participants by Email with Marketing Event Object Id + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recordByEmailAsyncWithHttpInfo($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + $request = $this->recordByEmailRequest($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $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 'recordByEmail' + * + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $subscriber_state The attendance state value. It may be 'register', 'attend' or 'cancel' (required) + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByEmail'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function recordByEmailRequest($object_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, string $contentType = self::contentTypes['recordByEmail'][0]) + { + + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $object_id when calling recordByEmail' + ); + } + + // verify the required parameter 'subscriber_state' is set + if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscriber_state when calling recordByEmail' + ); + } + + // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set + if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling recordByEmail' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/{objectId}/attendance/{subscriberState}/email-create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } + // path params + if ($subscriber_state !== null) { + $resourcePath = str_replace( + '{' . 'subscriberState' . '}', + ObjectSerializer::toPathValue($subscriber_state), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_email_subscriber)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); + } else { + $httpBody = $batch_input_marketing_event_email_subscriber; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Events/Api/BasicApi.php b/codegen/Marketing/Events/Api/BasicApi.php index 3800315a9..b4a631299 100644 --- a/codegen/Marketing/Events/Api/BasicApi.php +++ b/codegen/Marketing/Events/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -74,22 +74,16 @@ class BasicApi 'archive' => [ 'application/json', ], - 'batchArchive' => [ + 'archiveByObjectId' => [ 'application/json', ], - 'batchUpsert' => [ - 'application/json', - ], - 'cancel' => [ - 'application/json', - ], - 'complete' => [ + 'create' => [ 'application/json', ], - 'create' => [ + 'getAll' => [ 'application/json', ], - 'doSearch' => [ + 'getByObjectId' => [ 'application/json', ], 'getDetails' => [ @@ -98,6 +92,9 @@ class BasicApi 'update' => [ 'application/json', ], + 'updateByObjectId' => [ + 'application/json', + ], 'upsert' => [ 'application/json', ], @@ -110,13 +107,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -152,10 +149,10 @@ public function getConfig() /** * Operation archive * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -170,10 +167,10 @@ public function archive($external_event_id, $external_account_id, string $conten /** * Operation archiveWithHttpInfo * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -206,18 +203,6 @@ public function archiveWithHttpInfo($external_event_id, $external_account_id, st $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -239,10 +224,10 @@ public function archiveWithHttpInfo($external_event_id, $external_account_id, st /** * Operation archiveAsync * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -261,10 +246,10 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Delete a marketing event + * Delete Marketing Event by External Ids * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -301,8 +286,8 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $external_event_id The id of the marketing event to delete (required) - * @param string $external_account_id The account id associated with the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -412,38 +397,37 @@ public function archiveRequest($external_event_id, $external_account_id, string } /** - * Operation batchArchive + * Operation archiveByObjectId * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\Error + * @return void */ - public function batchArchive($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectId($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - list($response) = $this->batchArchiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType); - return $response; + $this->archiveByObjectIdWithHttpInfo($object_id, $contentType); } /** - * Operation batchArchiveWithHttpInfo + * Operation archiveByObjectIdWithHttpInfo * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function batchArchiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdWithHttpInfo($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - $request = $this->batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + $request = $this->archiveByObjectIdRequest($object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -467,76 +451,8 @@ public function batchArchiveWithHttpInfo($batch_input_marketing_event_external_u $statusCode = $response->getStatusCode(); - 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() - ); - } - - switch($statusCode) { - default: - if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - 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 [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { @@ -554,19 +470,19 @@ public function batchArchiveWithHttpInfo($batch_input_marketing_event_external_u } /** - * Operation batchArchiveAsync + * Operation archiveByObjectIdAsync * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchArchiveAsync($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdAsync($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - return $this->batchArchiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType) + return $this->archiveByObjectIdAsyncWithHttpInfo($object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -575,39 +491,26 @@ function ($response) { } /** - * Operation batchArchiveAsyncWithHttpInfo + * Operation archiveByObjectIdAsyncWithHttpInfo * - * Delete multiple marketing events + * Delete Marketing Event by objectId * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchArchiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; - $request = $this->batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, $contentType); + $returnType = ''; + $request = $this->archiveByObjectIdRequest($object_id, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -627,26 +530,26 @@ function ($exception) { } /** - * Create request for operation 'batchArchive' + * Create request for operation 'archiveByObjectId' * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchArchive'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function batchArchiveRequest($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['batchArchive'][0]) + public function archiveByObjectIdRequest($object_id, string $contentType = self::contentTypes['archiveByObjectId'][0]) { - // verify the required parameter 'batch_input_marketing_event_external_unique_identifier' is set - if ($batch_input_marketing_event_external_unique_identifier === null || (is_array($batch_input_marketing_event_external_unique_identifier) && count($batch_input_marketing_event_external_unique_identifier) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_external_unique_identifier when calling batchArchive' + 'Missing the required parameter $object_id when calling archiveByObjectId' ); } - $resourcePath = '/marketing/v3/marketing-events/events/delete'; + $resourcePath = '/marketing/v3/marketing-events/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -655,6 +558,14 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique + // path params + if ($object_id !== null) { + $resourcePath = str_replace( + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -664,14 +575,7 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique ); // for model (json/xml) - if (isset($batch_input_marketing_event_external_unique_identifier)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier)); - } else { - $httpBody = $batch_input_marketing_event_external_unique_identifier; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -714,7 +618,7 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -722,38 +626,38 @@ public function batchArchiveRequest($batch_input_marketing_event_external_unique } /** - * Operation batchUpsert + * Operation create * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function batchUpsert($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function create($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->batchUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType); + list($response) = $this->createWithHttpInfo($marketing_event_create_request_params, $contentType); return $response; } /** - * Operation batchUpsertWithHttpInfo + * Operation createWithHttpInfo * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - $request = $this->batchUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); + $request = $this->createRequest($marketing_event_create_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -777,26 +681,14 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -814,7 +706,7 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -847,7 +739,20 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -880,7 +785,7 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -899,19 +804,19 @@ public function batchUpsertWithHttpInfo($batch_input_marketing_event_create_requ } /** - * Operation batchUpsertAsync + * Operation createAsync * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchUpsertAsync($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createAsync($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - return $this->batchUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType) + return $this->createAsyncWithHttpInfo($marketing_event_create_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -920,20 +825,20 @@ function ($response) { } /** - * Operation batchUpsertAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Create or update multiple marketing events + * Create a marketing event * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function batchUpsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createAsyncWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; - $request = $this->batchUpsertRequest($batch_input_marketing_event_create_request_params, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->createRequest($marketing_event_create_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -972,26 +877,26 @@ function ($exception) { } /** - * Create request for operation 'batchUpsert' + * Create request for operation 'create' * - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['batchUpsert'] to see the possible values for this operation + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function batchUpsertRequest($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['batchUpsert'][0]) + public function createRequest($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_marketing_event_create_request_params' is set - if ($batch_input_marketing_event_create_request_params === null || (is_array($batch_input_marketing_event_create_request_params) && count($batch_input_marketing_event_create_request_params) === 0)) { + // verify the required parameter 'marketing_event_create_request_params' is set + if ($marketing_event_create_request_params === null || (is_array($marketing_event_create_request_params) && count($marketing_event_create_request_params) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_create_request_params when calling batchUpsert' + 'Missing the required parameter $marketing_event_create_request_params when calling create' ); } - $resourcePath = '/marketing/v3/marketing-events/events/upsert'; + $resourcePath = '/marketing/v3/marketing-events/events'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1009,12 +914,12 @@ public function batchUpsertRequest($batch_input_marketing_event_create_request_p ); // for model (json/xml) - if (isset($batch_input_marketing_event_create_request_params)) { + if (isset($marketing_event_create_request_params)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params)); } else { - $httpBody = $batch_input_marketing_event_create_request_params; + $httpBody = $marketing_event_create_request_params; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1067,40 +972,40 @@ public function batchUpsertRequest($batch_input_marketing_event_create_request_p } /** - * Operation cancel + * Operation getAll * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error */ - public function cancel($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAll($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - list($response) = $this->cancelWithHttpInfo($external_event_id, $external_account_id, $contentType); + list($response) = $this->getAllWithHttpInfo($after, $limit, $contentType); return $response; } /** - * Operation cancelWithHttpInfo + * Operation getAllWithHttpInfo * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function cancelWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllWithHttpInfo($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); + $request = $this->getAllRequest($after, $limit, $contentType); try { $options = $this->createHttpClientOption(); @@ -1124,26 +1029,14 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1161,7 +1054,7 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1194,7 +1087,20 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1227,7 +1133,7 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1246,20 +1152,20 @@ public function cancelWithHttpInfo($external_event_id, $external_account_id, str } /** - * Operation cancelAsync + * Operation getAllAsync * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllAsync($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - return $this->cancelAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + return $this->getAllAsyncWithHttpInfo($after, $limit, $contentType) ->then( function ($response) { return $response[0]; @@ -1268,21 +1174,21 @@ function ($response) { } /** - * Operation cancelAsyncWithHttpInfo + * Operation getAllAsyncWithHttpInfo * - * Mark a marketing event as cancelled + * Get all marketing event * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllAsyncWithHttpInfo($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging'; + $request = $this->getAllRequest($after, $limit, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1321,34 +1227,22 @@ function ($exception) { } /** - * Create request for operation 'cancel' + * Create request for operation 'getAll' * - * @param string $external_event_id The id of the marketing event to mark as cancelled (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function cancelRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) + public function getAllRequest($after = null, $limit = 10, string $contentType = self::contentTypes['getAll'][0]) { - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling cancel' - ); - } - // verify the required parameter 'external_account_id' is set - if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling cancel' - ); - } - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/cancel'; + $resourcePath = '/marketing/v3/marketing-events/'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1357,23 +1251,24 @@ public function cancelRequest($external_event_id, $external_account_id, string $ // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name + $after, + 'after', // param base name 'string', // openApiType 'form', // style true, // explode - true // required + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required ) ?? []); - // path params - if ($external_event_id !== null) { - $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -1426,7 +1321,7 @@ public function cancelRequest($external_event_id, $external_account_id, string $ $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1434,42 +1329,38 @@ public function cancelRequest($external_event_id, $external_account_id, string $ } /** - * Operation complete + * Operation getByObjectId * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2|\HubSpot\Client\Marketing\Events\Model\Error */ - public function complete($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectId($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - list($response) = $this->completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + list($response) = $this->getByObjectIdWithHttpInfo($object_id, $contentType); return $response; } /** - * Operation completeWithHttpInfo + * Operation getByObjectIdWithHttpInfo * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdWithHttpInfo($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + $request = $this->getByObjectIdRequest($object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1493,26 +1384,14 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1530,7 +1409,7 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1563,7 +1442,20 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1596,7 +1488,7 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1615,21 +1507,19 @@ public function completeWithHttpInfo($external_event_id, $external_account_id, $ } /** - * Operation completeAsync + * Operation getByObjectIdAsync * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function completeAsync($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdAsync($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - return $this->completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType) + return $this->getByObjectIdAsyncWithHttpInfo($object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1638,22 +1528,20 @@ function ($response) { } /** - * Operation completeAsyncWithHttpInfo + * Operation getByObjectIdAsyncWithHttpInfo * - * Mark a marketing event as completed + * Get Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdAsyncWithHttpInfo($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2'; + $request = $this->getByObjectIdRequest($object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1692,64 +1580,39 @@ function ($exception) { } /** - * Create request for operation 'complete' + * Create request for operation 'getByObjectId' * - * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) + public function getByObjectIdRequest($object_id, string $contentType = self::contentTypes['getByObjectId'][0]) { - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling complete' + 'Missing the required parameter $object_id when calling getByObjectId' ); } - // verify the required parameter 'external_account_id' is set - if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling complete' - ); - } - // verify the required parameter 'marketing_event_complete_request_params' is set - if ($marketing_event_complete_request_params === null || (is_array($marketing_event_complete_request_params) && count($marketing_event_complete_request_params) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_complete_request_params when calling complete' - ); - } - - - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/complete'; + $resourcePath = '/marketing/v3/marketing-events/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params - if ($external_event_id !== null) { + if ($object_id !== null) { $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), $resourcePath ); } @@ -1762,14 +1625,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke ); // for model (json/xml) - if (isset($marketing_event_complete_request_params)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params)); - } else { - $httpBody = $marketing_event_complete_request_params; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -1812,7 +1668,7 @@ public function completeRequest($external_event_id, $external_account_id, $marke $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1820,38 +1676,40 @@ public function completeRequest($external_event_id, $external_account_id, $marke } /** - * Operation create + * Operation getDetails * - * Create a marketing event + * Get Marketing Event by External IDs * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function create($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) + public function getDetails($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - list($response) = $this->createWithHttpInfo($marketing_event_create_request_params, $contentType); + list($response) = $this->getDetailsWithHttpInfo($external_event_id, $external_account_id, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation getDetailsWithHttpInfo * - * Create a marketing event + * Get Marketing Event by External IDs * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) + public function getDetailsWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - $request = $this->createRequest($marketing_event_create_request_params, $contentType); + $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1875,26 +1733,14 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1912,7 +1758,7 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1945,281 +1791,6 @@ public function createWithHttpInfo($marketing_event_create_request_params, strin ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - 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() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createAsync - * - * Create a marketing event - * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAsync($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) - { - return $this->createAsyncWithHttpInfo($marketing_event_create_request_params, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createAsyncWithHttpInfo - * - * Create a marketing event - * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createAsyncWithHttpInfo($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) - { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; - $request = $this->createRequest($marketing_event_create_request_params, $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 'create' - * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createRequest($marketing_event_create_request_params, string $contentType = self::contentTypes['create'][0]) - { - - // verify the required parameter 'marketing_event_create_request_params' is set - if ($marketing_event_create_request_params === null || (is_array($marketing_event_create_request_params) && count($marketing_event_create_request_params) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_create_request_params when calling create' - ); - } - - - $resourcePath = '/marketing/v3/marketing-events/events'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($marketing_event_create_request_params)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_create_request_params)); - } else { - $httpBody = $marketing_event_create_request_params; - } - } elseif (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( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation doSearch - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (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\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error - */ - public function doSearch($q, string $contentType = self::contentTypes['doSearch'][0]) - { - list($response) = $this->doSearchWithHttpInfo($q, $contentType); - return $response; - } - - /** - * Operation doSearchWithHttpInfo - * - * Search for marketing events - * - * @param string $q The id of the marketing event in the external event application (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\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function doSearchWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) - { - $request = $this->doSearchRequest($q, $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(); - if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -2227,70 +1798,13 @@ public function doSearchWithHttpInfo($q, string $contentType = self::contentType $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging' !== '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\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); } - $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -2323,7 +1837,7 @@ public function doSearchWithHttpInfo($q, string $contentType = self::contentType case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2342,19 +1856,20 @@ public function doSearchWithHttpInfo($q, string $contentType = self::contentType } /** - * Operation doSearchAsync + * Operation getDetailsAsync * - * Search for marketing events + * Get Marketing Event by External IDs * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($q, string $contentType = self::contentTypes['doSearch'][0]) + public function getDetailsAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - return $this->doSearchAsyncWithHttpInfo($q, $contentType) + return $this->getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2363,20 +1878,21 @@ function ($response) { } /** - * Operation doSearchAsyncWithHttpInfo + * Operation getDetailsAsyncWithHttpInfo * - * Search for marketing events + * Get Marketing Event by External IDs * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) + public function getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; - $request = $this->doSearchRequest($q, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; + $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2415,26 +1931,34 @@ function ($exception) { } /** - * Create request for operation 'doSearch' + * Create request for operation 'getDetails' * - * @param string $q The id of the marketing event in the external event application (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($q, string $contentType = self::contentTypes['doSearch'][0]) + public function getDetailsRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) { - // verify the required parameter 'q' is set - if ($q === null || (is_array($q) && count($q) === 0)) { + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling getDetails' + ); + } + + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $q when calling doSearch' + 'Missing the required parameter $external_account_id when calling getDetails' ); } - $resourcePath = '/marketing/v3/marketing-events/events/search'; + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2443,8 +1967,8 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $q, - 'q', // param base name + $external_account_id, + 'externalAccountId', // param base name 'string', // openApiType 'form', // style true, // explode @@ -2452,6 +1976,14 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do ) ?? []); + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -2512,40 +2044,42 @@ public function doSearchRequest($q, string $contentType = self::contentTypes['do } /** - * Operation getDetails + * Operation update * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function getDetails($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function update($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->getDetailsWithHttpInfo($external_event_id, $external_account_id, $contentType); + list($response) = $this->updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); return $response; } /** - * Operation getDetailsWithHttpInfo + * Operation updateWithHttpInfo * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getDetailsWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); + $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -2569,26 +2103,14 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -2606,7 +2128,7 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2639,7 +2161,20 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -2672,7 +2207,7 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2691,20 +2226,21 @@ public function getDetailsWithHttpInfo($external_event_id, $external_account_id, } /** - * Operation getDetailsAsync + * Operation updateAsync * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getDetailsAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateAsync($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - return $this->getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) + return $this->updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -2713,21 +2249,22 @@ function ($response) { } /** - * Operation getDetailsAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * Get a marketing event + * Update Marketing Event by External IDs * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getDetailsAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponse'; - $request = $this->getDetailsRequest($external_event_id, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; + $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2766,29 +2303,37 @@ function ($exception) { } /** - * Create request for operation 'getDetails' + * Create request for operation 'update' * - * @param string $external_event_id The id of the marketing event to return (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDetails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getDetailsRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['getDetails'][0]) + public function updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling getDetails' + 'Missing the required parameter $external_event_id when calling update' ); } // verify the required parameter 'external_account_id' is set if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling getDetails' + 'Missing the required parameter $external_account_id when calling update' + ); + } + + // verify the required parameter 'marketing_event_update_request_params' is set + if ($marketing_event_update_request_params === null || (is_array($marketing_event_update_request_params) && count($marketing_event_update_request_params) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $marketing_event_update_request_params when calling update' ); } @@ -2828,7 +2373,14 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($marketing_event_update_request_params)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params)); + } else { + $httpBody = $marketing_event_update_request_params; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -2871,7 +2423,7 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'PATCH', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2879,42 +2431,40 @@ public function getDetailsRequest($external_event_id, $external_account_id, stri } /** - * Operation update + * Operation updateByObjectId * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\Error */ - public function update($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectId($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - list($response) = $this->updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + list($response) = $this->updateByObjectIdWithHttpInfo($object_id, $marketing_event_public_update_request_v2, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation updateByObjectIdWithHttpInfo * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdWithHttpInfo($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + $request = $this->updateByObjectIdRequest($object_id, $marketing_event_public_update_request_v2, $contentType); try { $options = $this->createHttpClientOption(); @@ -2938,26 +2488,14 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -2975,7 +2513,7 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3008,7 +2546,20 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -3041,7 +2592,7 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3060,21 +2611,20 @@ public function updateWithHttpInfo($external_event_id, $external_account_id, $ma } /** - * Operation updateAsync + * Operation updateByObjectIdAsync * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdAsync($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - return $this->updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType) + return $this->updateByObjectIdAsyncWithHttpInfo($object_id, $marketing_event_public_update_request_v2, $contentType) ->then( function ($response) { return $response[0]; @@ -3083,22 +2633,21 @@ function ($response) { } /** - * Operation updateAsyncWithHttpInfo + * Operation updateByObjectIdAsyncWithHttpInfo * - * Update a marketing event + * Update Marketing Event by objectId * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdAsyncWithHttpInfo($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; - $request = $this->updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2'; + $request = $this->updateByObjectIdRequest($object_id, $marketing_event_public_update_request_v2, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3137,64 +2686,47 @@ function ($exception) { } /** - * Create request for operation 'update' + * Create request for operation 'updateByObjectId' * - * @param string $external_event_id The id of the marketing event to update (required) - * @param string $external_account_id The account id associated with the marketing event (required) - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventUpdateRequestParams $marketing_event_update_request_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param string $object_id The internal ID of the marketing event in HubSpot (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestV2 $marketing_event_public_update_request_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($external_event_id, $external_account_id, $marketing_event_update_request_params, string $contentType = self::contentTypes['update'][0]) + public function updateByObjectIdRequest($object_id, $marketing_event_public_update_request_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) { - // verify the required parameter 'external_event_id' is set - if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling update' - ); - } - - // verify the required parameter 'external_account_id' is set - if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_account_id when calling update' + 'Missing the required parameter $object_id when calling updateByObjectId' ); } - // verify the required parameter 'marketing_event_update_request_params' is set - if ($marketing_event_update_request_params === null || (is_array($marketing_event_update_request_params) && count($marketing_event_update_request_params) === 0)) { + // verify the required parameter 'marketing_event_public_update_request_v2' is set + if ($marketing_event_public_update_request_v2 === null || (is_array($marketing_event_public_update_request_v2) && count($marketing_event_public_update_request_v2) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $marketing_event_update_request_params when calling update' + 'Missing the required parameter $marketing_event_public_update_request_v2 when calling updateByObjectId' ); } - $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}'; + $resourcePath = '/marketing/v3/marketing-events/{objectId}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $external_account_id, - 'externalAccountId', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params - if ($external_event_id !== null) { + if ($object_id !== null) { $resourcePath = str_replace( - '{' . 'externalEventId' . '}', - ObjectSerializer::toPathValue($external_event_id), + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), $resourcePath ); } @@ -3207,12 +2739,12 @@ public function updateRequest($external_event_id, $external_account_id, $marketi ); // for model (json/xml) - if (isset($marketing_event_update_request_params)) { + if (isset($marketing_event_public_update_request_v2)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_update_request_params)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_public_update_request_v2)); } else { - $httpBody = $marketing_event_update_request_params; + $httpBody = $marketing_event_public_update_request_v2; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -3269,7 +2801,7 @@ public function updateRequest($external_event_id, $external_account_id, $marketi * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3288,7 +2820,7 @@ public function upsert($external_event_id, $marketing_event_create_request_param * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3322,18 +2854,6 @@ public function upsertWithHttpInfo($external_event_id, $marketing_event_create_r $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -3392,6 +2912,19 @@ public function upsertWithHttpInfo($external_event_id, $marketing_event_create_r ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3448,7 +2981,7 @@ public function upsertWithHttpInfo($external_event_id, $marketing_event_create_r * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3470,7 +3003,7 @@ function ($response) { * * Create or update a marketing event * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -3521,7 +3054,7 @@ function ($exception) { /** * Create request for operation 'upsert' * - * @param string $external_event_id The ID of the marketing event to upsert (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCreateRequestParams $marketing_event_create_request_params (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * diff --git a/codegen/Marketing/Events/Api/BatchApi.php b/codegen/Marketing/Events/Api/BatchApi.php new file mode 100644 index 000000000..9c815b875 --- /dev/null +++ b/codegen/Marketing/Events/Api/BatchApi.php @@ -0,0 +1,1418 @@ + [ + 'application/json', + ], + 'archiveByObjectId' => [ + 'application/json', + ], + 'updateByObjectId' => [ + 'application/json', + ], + 'upsert' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation archive + * + * Delete Multiple Marketing Events by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\Error + */ + public function archive($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + list($response) = $this->archiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType); + return $response; + } + + /** + * Operation archiveWithHttpInfo + * + * Delete Multiple Marketing Events by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + $request = $this->archiveRequest($batch_input_marketing_event_external_unique_identifier, $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) { + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveAsync + * + * Delete Multiple Marketing Events by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsync($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + return $this->archiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveAsyncWithHttpInfo + * + * Delete Multiple Marketing Events by External Ids + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveAsyncWithHttpInfo($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; + $request = $this->archiveRequest($batch_input_marketing_event_external_unique_identifier, $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 'archive' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventExternalUniqueIdentifier $batch_input_marketing_event_external_unique_identifier (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveRequest($batch_input_marketing_event_external_unique_identifier, string $contentType = self::contentTypes['archive'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_external_unique_identifier' is set + if ($batch_input_marketing_event_external_unique_identifier === null || (is_array($batch_input_marketing_event_external_unique_identifier) && count($batch_input_marketing_event_external_unique_identifier) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_external_unique_identifier when calling archive' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/delete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_external_unique_identifier)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_external_unique_identifier)); + } else { + $httpBody = $batch_input_marketing_event_external_unique_identifier; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation archiveByObjectId + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archiveByObjectId($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + $this->archiveByObjectIdWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, $contentType); + } + + /** + * Operation archiveByObjectIdWithHttpInfo + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveByObjectIdWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + $request = $this->archiveByObjectIdRequest($batch_input_marketing_event_public_object_id_delete_request, $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(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveByObjectIdAsync + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveByObjectIdAsync($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + return $this->archiveByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveByObjectIdAsyncWithHttpInfo + * + * Delete Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + $returnType = ''; + $request = $this->archiveByObjectIdRequest($batch_input_marketing_event_public_object_id_delete_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'archiveByObjectId' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicObjectIdDeleteRequest $batch_input_marketing_event_public_object_id_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveByObjectIdRequest($batch_input_marketing_event_public_object_id_delete_request, string $contentType = self::contentTypes['archiveByObjectId'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_public_object_id_delete_request' is set + if ($batch_input_marketing_event_public_object_id_delete_request === null || (is_array($batch_input_marketing_event_public_object_id_delete_request) && count($batch_input_marketing_event_public_object_id_delete_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_public_object_id_delete_request when calling archiveByObjectId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/batch/archive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_public_object_id_delete_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_object_id_delete_request)); + } else { + $httpBody = $batch_input_marketing_event_public_object_id_delete_request; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateByObjectId + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function updateByObjectId($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + list($response) = $this->updateByObjectIdWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, $contentType); + return $response; + } + + /** + * Operation updateByObjectIdWithHttpInfo + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2|\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateByObjectIdWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + $request = $this->updateByObjectIdRequest($batch_input_marketing_event_public_update_request_full_v2, $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: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2' !== '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\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 207: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors' !== '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\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2WithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateByObjectIdAsync + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateByObjectIdAsync($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + return $this->updateByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateByObjectIdAsyncWithHttpInfo + * + * Update Multiple Marketing Events by ObjectId + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateByObjectIdAsyncWithHttpInfo($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponseV2'; + $request = $this->updateByObjectIdRequest($batch_input_marketing_event_public_update_request_full_v2, $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 'updateByObjectId' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventPublicUpdateRequestFullV2 $batch_input_marketing_event_public_update_request_full_v2 (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateByObjectId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateByObjectIdRequest($batch_input_marketing_event_public_update_request_full_v2, string $contentType = self::contentTypes['updateByObjectId'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_public_update_request_full_v2' is set + if ($batch_input_marketing_event_public_update_request_full_v2 === null || (is_array($batch_input_marketing_event_public_update_request_full_v2) && count($batch_input_marketing_event_public_update_request_full_v2) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_public_update_request_full_v2 when calling updateByObjectId' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/batch/update'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_public_update_request_full_v2)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_public_update_request_full_v2)); + } else { + $httpBody = $batch_input_marketing_event_public_update_request_full_v2; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upsert + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error + */ + public function upsert($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + list($response) = $this->upsertWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType); + return $response; + } + + /** + * Operation upsertWithHttpInfo + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + $request = $this->upsertRequest($batch_input_marketing_event_create_request_params, $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: + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse' !== '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\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Marketing\Events\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\Marketing\Events\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Marketing\Events\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertAsync + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsync($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + return $this->upsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertAsyncWithHttpInfo + * + * Create or Update Multiple Marketing Events + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertAsyncWithHttpInfo($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseMarketingEventPublicDefaultResponse'; + $request = $this->upsertRequest($batch_input_marketing_event_create_request_params, $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 'upsert' + * + * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventCreateRequestParams $batch_input_marketing_event_create_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertRequest($batch_input_marketing_event_create_request_params, string $contentType = self::contentTypes['upsert'][0]) + { + + // verify the required parameter 'batch_input_marketing_event_create_request_params' is set + if ($batch_input_marketing_event_create_request_params === null || (is_array($batch_input_marketing_event_create_request_params) && count($batch_input_marketing_event_create_request_params) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batch_input_marketing_event_create_request_params when calling upsert' + ); + } + + + $resourcePath = '/marketing/v3/marketing-events/events/upsert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($batch_input_marketing_event_create_request_params)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_create_request_params)); + } else { + $httpBody = $batch_input_marketing_event_create_request_params; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php b/codegen/Marketing/Events/Api/ChangePropertyApi.php similarity index 64% rename from codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php rename to codegen/Marketing/Events/Api/ChangePropertyApi.php index 6a163ea46..ebcaec649 100644 --- a/codegen/Marketing/Events/Api/AttendanceSubscriberStateChangesApi.php +++ b/codegen/Marketing/Events/Api/ChangePropertyApi.php @@ -1,6 +1,6 @@ [ + 'cancel' => [ 'application/json', ], - 'recordByContactIds' => [ + 'complete' => [ 'application/json', ], ]; @@ -86,13 +86,13 @@ class AttendanceSubscriberStateChangesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -126,44 +126,40 @@ public function getConfig() } /** - * Operation recordByContactEmails + * Operation cancel * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function recordByContactEmails($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancel($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - list($response) = $this->recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + list($response) = $this->cancelWithHttpInfo($external_event_id, $external_account_id, $contentType); return $response; } /** - * Operation recordByContactEmailsWithHttpInfo + * Operation cancelWithHttpInfo * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function recordByContactEmailsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -187,26 +183,14 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -224,7 +208,7 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -257,7 +241,20 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -290,7 +287,7 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -309,22 +306,20 @@ public function recordByContactEmailsWithHttpInfo($external_event_id, $subscribe } /** - * Operation recordByContactEmailsAsync + * Operation cancelAsync * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactEmailsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelAsync($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - return $this->recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType) + return $this->cancelAsyncWithHttpInfo($external_event_id, $external_account_id, $contentType) ->then( function ($response) { return $response[0]; @@ -333,23 +328,21 @@ function ($response) { } /** - * Operation recordByContactEmailsAsyncWithHttpInfo + * Operation cancelAsyncWithHttpInfo * - * Record a subscriber state by contact email + * Mark a marketing event as cancelled * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactEmailsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelAsyncWithHttpInfo($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberEmailResponse'; - $request = $this->recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->cancelRequest($external_event_id, $external_account_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -388,44 +381,34 @@ function ($exception) { } /** - * Create request for operation 'recordByContactEmails' + * Create request for operation 'cancel' * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactEmails'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancel'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function recordByContactEmailsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_email_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactEmails'][0]) + public function cancelRequest($external_event_id, $external_account_id, string $contentType = self::contentTypes['cancel'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling recordByContactEmails' - ); - } - - // verify the required parameter 'subscriber_state' is set - if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling recordByContactEmails' + 'Missing the required parameter $external_event_id when calling cancel' ); } - // verify the required parameter 'batch_input_marketing_event_email_subscriber' is set - if ($batch_input_marketing_event_email_subscriber === null || (is_array($batch_input_marketing_event_email_subscriber) && count($batch_input_marketing_event_email_subscriber) === 0)) { + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_email_subscriber when calling recordByContactEmails' + 'Missing the required parameter $external_account_id when calling cancel' ); } - - $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/email-create'; + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/cancel'; $formParams = []; $queryParams = []; $headerParams = []; @@ -439,7 +422,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta 'string', // openApiType 'form', // style true, // explode - false // required + true // required ) ?? []); @@ -451,14 +434,6 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta $resourcePath ); } - // path params - if ($subscriber_state !== null) { - $resourcePath = str_replace( - '{' . 'subscriberState' . '}', - ObjectSerializer::toPathValue($subscriber_state), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -468,14 +443,7 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta ); // for model (json/xml) - if (isset($batch_input_marketing_event_email_subscriber)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_email_subscriber)); - } else { - $httpBody = $batch_input_marketing_event_email_subscriber; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -526,44 +494,42 @@ public function recordByContactEmailsRequest($external_event_id, $subscriber_sta } /** - * Operation recordByContactIds + * Operation complete * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error */ - public function recordByContactIds($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function complete($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - list($response) = $this->recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + list($response) = $this->completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); return $response; } /** - * Operation recordByContactIdsWithHttpInfo + * Operation completeWithHttpInfo * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -587,26 +553,14 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -624,7 +578,7 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -657,7 +611,20 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s ]; } - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -690,7 +657,7 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse', + '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -709,22 +676,21 @@ public function recordByContactIdsWithHttpInfo($external_event_id, $subscriber_s } /** - * Operation recordByContactIdsAsync + * Operation completeAsync * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactIdsAsync($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeAsync($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - return $this->recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType) + return $this->completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType) ->then( function ($response) { return $response[0]; @@ -733,23 +699,22 @@ function ($response) { } /** - * Operation recordByContactIdsAsyncWithHttpInfo + * Operation completeAsyncWithHttpInfo * - * Record a subscriber state by contact ids + * Mark a marketing event as completed * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function recordByContactIdsAsyncWithHttpInfo($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeAsyncWithHttpInfo($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { - $returnType = '\HubSpot\Client\Marketing\Events\Model\BatchResponseSubscriberVidResponse'; - $request = $this->recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\MarketingEventDefaultResponse'; + $request = $this->completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -788,44 +753,42 @@ function ($exception) { } /** - * Create request for operation 'recordByContactIds' + * Create request for operation 'complete' * - * @param string $external_event_id The id of the marketing event (required) - * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) - * @param string $external_account_id The account id associated with the marketing event (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['recordByContactIds'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventCompleteRequestParams $marketing_event_complete_request_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['complete'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function recordByContactIdsRequest($external_event_id, $subscriber_state, $batch_input_marketing_event_subscriber, $external_account_id = null, string $contentType = self::contentTypes['recordByContactIds'][0]) + public function completeRequest($external_event_id, $external_account_id, $marketing_event_complete_request_params, string $contentType = self::contentTypes['complete'][0]) { // verify the required parameter 'external_event_id' is set if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $external_event_id when calling recordByContactIds' + 'Missing the required parameter $external_event_id when calling complete' ); } - // verify the required parameter 'subscriber_state' is set - if ($subscriber_state === null || (is_array($subscriber_state) && count($subscriber_state) === 0)) { + // verify the required parameter 'external_account_id' is set + if ($external_account_id === null || (is_array($external_account_id) && count($external_account_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscriber_state when calling recordByContactIds' + 'Missing the required parameter $external_account_id when calling complete' ); } - // verify the required parameter 'batch_input_marketing_event_subscriber' is set - if ($batch_input_marketing_event_subscriber === null || (is_array($batch_input_marketing_event_subscriber) && count($batch_input_marketing_event_subscriber) === 0)) { + // verify the required parameter 'marketing_event_complete_request_params' is set + if ($marketing_event_complete_request_params === null || (is_array($marketing_event_complete_request_params) && count($marketing_event_complete_request_params) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_marketing_event_subscriber when calling recordByContactIds' + 'Missing the required parameter $marketing_event_complete_request_params when calling complete' ); } - - $resourcePath = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/create'; + $resourcePath = '/marketing/v3/marketing-events/events/{externalEventId}/complete'; $formParams = []; $queryParams = []; $headerParams = []; @@ -839,7 +802,7 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, 'string', // openApiType 'form', // style true, // explode - false // required + true // required ) ?? []); @@ -851,14 +814,6 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, $resourcePath ); } - // path params - if ($subscriber_state !== null) { - $resourcePath = str_replace( - '{' . 'subscriberState' . '}', - ObjectSerializer::toPathValue($subscriber_state), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( @@ -868,12 +823,12 @@ public function recordByContactIdsRequest($external_event_id, $subscriber_state, ); // for model (json/xml) - if (isset($batch_input_marketing_event_subscriber)) { + if (isset($marketing_event_complete_request_params)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_marketing_event_subscriber)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($marketing_event_complete_request_params)); } else { - $httpBody = $batch_input_marketing_event_subscriber; + $httpBody = $marketing_event_complete_request_params; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/codegen/Cms/Performance/Api/PublicPerformanceApi.php b/codegen/Marketing/Events/Api/IdentifiersApi.php similarity index 50% rename from codegen/Cms/Performance/Api/PublicPerformanceApi.php rename to codegen/Marketing/Events/Api/IdentifiersApi.php index 8ccc229f8..130ca9135 100644 --- a/codegen/Cms/Performance/Api/PublicPerformanceApi.php +++ b/codegen/Marketing/Events/Api/IdentifiersApi.php @@ -1,22 +1,22 @@ [ + 'doSearch' => [ 'application/json', ], - 'getUptime' => [ + 'searchPortalEvents' => [ 'application/json', ], ]; @@ -86,13 +86,13 @@ class PublicPerformanceApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -126,52 +126,38 @@ public function getConfig() } /** - * Operation getPage + * Operation doSearch * - * View your website's performance. + * Find App-Specific Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path The url path of the domain to return data for. (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (externalEventId) (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\Cms\Performance\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse|\HubSpot\Client\Cms\Performance\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging|\HubSpot\Client\Marketing\Events\Model\Error */ - public function getPage($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getPage'][0]) + public function doSearch($q, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->getPageWithHttpInfo($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType); + list($response) = $this->doSearchWithHttpInfo($q, $contentType); return $response; } /** - * Operation getPageWithHttpInfo + * Operation doSearchWithHttpInfo * - * View your website's performance. + * Find App-Specific Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path The url path of the domain to return data for. (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (externalEventId) (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\Cms\Performance\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse|\HubSpot\Client\Cms\Performance\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getPage'][0]) + public function doSearchWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->getPageRequest($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType); + $request = $this->doSearchRequest($q, $contentType); try { $options = $this->createHttpClientOption(); @@ -195,26 +181,14 @@ public function getPageWithHttpInfo($domain = null, $path = null, $pad = null, $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -232,16 +206,16 @@ public function getPageWithHttpInfo($domain = null, $path = null, $pad = null, $ } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging', []), $response->getStatusCode(), $response->getHeaders() ]; default: - if ('\HubSpot\Client\Cms\Performance\Model\Error' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Performance\Model\Error' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -259,13 +233,26 @@ public function getPageWithHttpInfo($domain = null, $path = null, $pad = null, $ } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Performance\Model\Error', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -298,7 +285,7 @@ public function getPageWithHttpInfo($domain = null, $path = null, $pad = null, $ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse', + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -306,7 +293,7 @@ public function getPageWithHttpInfo($domain = null, $path = null, $pad = null, $ default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Cms\Performance\Model\Error', + '\HubSpot\Client\Marketing\Events\Model\Error', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -317,26 +304,19 @@ public function getPageWithHttpInfo($domain = null, $path = null, $pad = null, $ } /** - * Operation getPageAsync + * Operation doSearchAsync * - * View your website's performance. + * Find App-Specific Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path The url path of the domain to return data for. (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getPage'][0]) + public function doSearchAsync($q, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->getPageAsyncWithHttpInfo($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType) + return $this->doSearchAsyncWithHttpInfo($q, $contentType) ->then( function ($response) { return $response[0]; @@ -345,27 +325,20 @@ function ($response) { } /** - * Operation getPageAsyncWithHttpInfo + * Operation doSearchAsyncWithHttpInfo * - * View your website's performance. + * Find App-Specific Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path The url path of the domain to return data for. (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getPage'][0]) + public function doSearchAsyncWithHttpInfo($q, string $contentType = self::contentTypes['doSearch'][0]) { - $returnType = '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse'; - $request = $this->getPageRequest($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseSearchPublicResponseWrapperNoPaging'; + $request = $this->doSearchRequest($q, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -404,34 +377,26 @@ function ($exception) { } /** - * Create request for operation 'getPage' + * Create request for operation 'doSearch' * - * @param string $domain The domain to search return data for. (optional) - * @param string $path The url path of the domain to return data for. (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation + * @param string $q The id of the marketing event in the external event application (externalEventId) (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getPage'][0]) + public function doSearchRequest($q, string $contentType = self::contentTypes['doSearch'][0]) { + // verify the required parameter 'q' is set + if ($q === null || (is_array($q) && count($q) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $q when calling doSearch' + ); + } - - - - - - - - $resourcePath = '/cms/v3/performance/'; + $resourcePath = '/marketing/v3/marketing-events/events/search'; $formParams = []; $queryParams = []; $headerParams = []; @@ -440,75 +405,12 @@ public function getPageRequest($domain = null, $path = null, $pad = null, $sum = // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $domain, - 'domain', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $path, - 'path', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $pad, - 'pad', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $sum, - 'sum', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $period, - 'period', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $interval, - 'interval', // param base name + $q, + 'q', // param base name 'string', // openApiType 'form', // style true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $start, - 'start', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $end, - 'end', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required + true // required ) ?? []); @@ -572,52 +474,38 @@ public function getPageRequest($domain = null, $path = null, $pad = null, $sum = } /** - * Operation getUptime + * Operation searchPortalEvents * - * View your website's uptime. + * Find Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path path (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUptime'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation * - * @throws \HubSpot\Client\Cms\Performance\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse|\HubSpot\Client\Cms\Performance\Model\Error + * @return \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging|\HubSpot\Client\Marketing\Events\Model\Error */ - public function getUptime($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getUptime'][0]) + public function searchPortalEvents($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) { - list($response) = $this->getUptimeWithHttpInfo($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType); + list($response) = $this->searchPortalEventsWithHttpInfo($external_event_id, $contentType); return $response; } /** - * Operation getUptimeWithHttpInfo + * Operation searchPortalEventsWithHttpInfo * - * View your website's uptime. + * Find Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUptime'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation * - * @throws \HubSpot\Client\Cms\Performance\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse|\HubSpot\Client\Cms\Performance\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging|\HubSpot\Client\Marketing\Events\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getUptimeWithHttpInfo($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getUptime'][0]) + public function searchPortalEventsWithHttpInfo($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) { - $request = $this->getUptimeRequest($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType); + $request = $this->searchPortalEventsRequest($external_event_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -641,26 +529,14 @@ public function getUptimeWithHttpInfo($domain = null, $path = null, $pad = null, $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: - if ('\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -678,16 +554,16 @@ public function getUptimeWithHttpInfo($domain = null, $path = null, $pad = null, } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging', []), $response->getStatusCode(), $response->getHeaders() ]; default: - if ('\HubSpot\Client\Cms\Performance\Model\Error' === '\SplFileObject') { + if ('\HubSpot\Client\Marketing\Events\Model\Error' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\HubSpot\Client\Cms\Performance\Model\Error' !== 'string') { + if ('\HubSpot\Client\Marketing\Events\Model\Error' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -705,13 +581,26 @@ public function getUptimeWithHttpInfo($domain = null, $path = null, $pad = null, } return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Cms\Performance\Model\Error', []), + ObjectSerializer::deserialize($content, '\HubSpot\Client\Marketing\Events\Model\Error', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse'; + 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() + ); + } + + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -744,7 +633,7 @@ public function getUptimeWithHttpInfo($domain = null, $path = null, $pad = null, case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse', + '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -752,7 +641,7 @@ public function getUptimeWithHttpInfo($domain = null, $path = null, $pad = null, default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Cms\Performance\Model\Error', + '\HubSpot\Client\Marketing\Events\Model\Error', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -763,26 +652,19 @@ public function getUptimeWithHttpInfo($domain = null, $path = null, $pad = null, } /** - * Operation getUptimeAsync + * Operation searchPortalEventsAsync * - * View your website's uptime. + * Find Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUptime'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getUptimeAsync($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getUptime'][0]) + public function searchPortalEventsAsync($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) { - return $this->getUptimeAsyncWithHttpInfo($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType) + return $this->searchPortalEventsAsyncWithHttpInfo($external_event_id, $contentType) ->then( function ($response) { return $response[0]; @@ -791,27 +673,20 @@ function ($response) { } /** - * Operation getUptimeAsyncWithHttpInfo + * Operation searchPortalEventsAsyncWithHttpInfo * - * View your website's uptime. + * Find Marketing Events by External Event Id * - * @param string $domain The domain to search return data for. (optional) - * @param string $path (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUptime'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getUptimeAsyncWithHttpInfo($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getUptime'][0]) + public function searchPortalEventsAsyncWithHttpInfo($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) { - $returnType = '\HubSpot\Client\Cms\Performance\Model\PublicPerformanceResponse'; - $request = $this->getUptimeRequest($domain, $path, $pad, $sum, $period, $interval, $start, $end, $contentType); + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging'; + $request = $this->searchPortalEventsRequest($external_event_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -850,114 +725,42 @@ function ($exception) { } /** - * Create request for operation 'getUptime' + * Create request for operation 'searchPortalEvents' * - * @param string $domain The domain to search return data for. (optional) - * @param string $path (optional) - * @param bool $pad Specifies whether the time series data should have empty intervals if performance data is not present to create a continuous set. (optional) - * @param bool $sum Specifies whether the time series data should be summated for the given period. Defaults to false. (optional) - * @param string $period A relative period to return time series data for. This value is ignored if start and/or end are provided. Valid periods: [15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param string $interval The time series interval to group data by. Valid intervals: [1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w] (optional) - * @param int $start A timestamp in milliseconds that indicates the start of the time period. (optional) - * @param int $end A timestamp in milliseconds that indicates the end of the time period. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUptime'] to see the possible values for this operation + * @param string $external_event_id The id of the marketing event in the external event application. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchPortalEvents'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getUptimeRequest($domain = null, $path = null, $pad = null, $sum = null, $period = null, $interval = null, $start = null, $end = null, string $contentType = self::contentTypes['getUptime'][0]) + public function searchPortalEventsRequest($external_event_id, string $contentType = self::contentTypes['searchPortalEvents'][0]) { + // verify the required parameter 'external_event_id' is set + if ($external_event_id === null || (is_array($external_event_id) && count($external_event_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $external_event_id when calling searchPortalEvents' + ); + } - - - - - - - - $resourcePath = '/cms/v3/performance/uptime'; + $resourcePath = '/marketing/v3/marketing-events/{externalEventId}/identifiers'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $domain, - 'domain', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $path, - 'path', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $pad, - 'pad', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $sum, - 'sum', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $period, - 'period', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $interval, - 'interval', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $start, - 'start', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $end, - 'end', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); + // path params + if ($external_event_id !== null) { + $resourcePath = str_replace( + '{' . 'externalEventId' . '}', + ObjectSerializer::toPathValue($external_event_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( diff --git a/codegen/Marketing/Events/Api/ListAssociationsApi.php b/codegen/Marketing/Events/Api/ListAssociationsApi.php index 83c36717c..0405ab1b4 100644 --- a/codegen/Marketing/Events/Api/ListAssociationsApi.php +++ b/codegen/Marketing/Events/Api/ListAssociationsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -98,13 +98,13 @@ class ListAssociationsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -196,18 +196,6 @@ public function associateByExternalAccountAndEventIdsWithHttpInfo($external_acco $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -475,18 +463,6 @@ public function associateByMarketingEventIdWithHttpInfo($marketing_event_id, $li $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -738,18 +714,6 @@ public function disassociateByExternalAccountAndEventIdsWithHttpInfo($external_a $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1017,18 +981,6 @@ public function disassociateByMarketingEventIdWithHttpInfo($marketing_event_id, $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -1226,7 +1178,7 @@ public function disassociateByMarketingEventIdRequest($marketing_event_id, $list * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1245,7 +1197,7 @@ public function getAllByExternalAccountAndEventIds($external_account_id, $extern * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1279,18 +1231,6 @@ public function getAllByExternalAccountAndEventIdsWithHttpInfo($external_account $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1349,6 +1289,19 @@ public function getAllByExternalAccountAndEventIdsWithHttpInfo($external_account ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1405,7 +1358,7 @@ public function getAllByExternalAccountAndEventIdsWithHttpInfo($external_account * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1427,7 +1380,7 @@ function ($response) { * * Get lists associated with a marketing event * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1478,7 +1431,7 @@ function ($exception) { /** * Create request for operation 'getAllByExternalAccountAndEventIds' * - * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllByExternalAccountAndEventIds'] to see the possible values for this operation * @@ -1643,18 +1596,6 @@ public function getAllByMarketingEventIdWithHttpInfo($marketing_event_id, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1713,6 +1654,19 @@ public function getAllByMarketingEventIdWithHttpInfo($marketing_event_id, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalPublicListNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Marketing/Events/Api/ParticipantStateApi.php b/codegen/Marketing/Events/Api/RetrieveParticipantStateApi.php similarity index 92% rename from codegen/Marketing/Events/Api/ParticipantStateApi.php rename to codegen/Marketing/Events/Api/RetrieveParticipantStateApi.php index f2d9a85c3..2f65019b2 100644 --- a/codegen/Marketing/Events/Api/ParticipantStateApi.php +++ b/codegen/Marketing/Events/Api/RetrieveParticipantStateApi.php @@ -1,6 +1,6 @@ client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -140,9 +140,9 @@ public function getConfig() * Read participations breakdown by Contact identifier * * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -161,9 +161,9 @@ public function getParticipationsBreakdownByContactId($contact_identifier, $stat * Read participations breakdown by Contact identifier * * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -196,18 +196,6 @@ public function getParticipationsBreakdownByContactIdWithHttpInfo($contact_ident $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -266,6 +254,19 @@ public function getParticipationsBreakdownByContactIdWithHttpInfo($contact_ident ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -323,9 +324,9 @@ public function getParticipationsBreakdownByContactIdWithHttpInfo($contact_ident * Read participations breakdown by Contact identifier * * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -347,9 +348,9 @@ function ($response) { * Read participations breakdown by Contact identifier * * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -400,9 +401,9 @@ function ($exception) { * Create request for operation 'getParticipationsBreakdownByContactId' * * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (required) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByContactId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -532,10 +533,10 @@ public function getParticipationsBreakdownByContactIdRequest($contact_identifier * * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -555,10 +556,10 @@ public function getParticipationsBreakdownByExternalEventId($external_account_id * * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -591,18 +592,6 @@ public function getParticipationsBreakdownByExternalEventIdWithHttpInfo($externa $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -661,6 +650,19 @@ public function getParticipationsBreakdownByExternalEventIdWithHttpInfo($externa ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -719,10 +721,10 @@ public function getParticipationsBreakdownByExternalEventIdWithHttpInfo($externa * * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -745,10 +747,10 @@ function ($response) { * * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -800,10 +802,10 @@ function ($exception) { * * @param string $external_account_id The accountId that is associated with this marketing event in the external event application. (required) * @param string $external_event_id The id of the marketing event in the external event application. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByExternalEventId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -957,10 +959,10 @@ public function getParticipationsBreakdownByExternalEventIdRequest($external_acc * Read participations breakdown by Marketing Event internal identifier * * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -979,10 +981,10 @@ public function getParticipationsBreakdownByMarketingEventId($marketing_event_id * Read participations breakdown by Marketing Event internal identifier * * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Events\ApiException on non-2xx response or if the response body is not in the expected format @@ -1015,18 +1017,6 @@ public function getParticipationsBreakdownByMarketingEventIdWithHttpInfo($market $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1085,6 +1075,19 @@ public function getParticipationsBreakdownByMarketingEventIdWithHttpInfo($market ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\CollectionResponseWithTotalParticipationBreakdownForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1142,10 +1145,10 @@ public function getParticipationsBreakdownByMarketingEventIdWithHttpInfo($market * Read participations breakdown by Marketing Event internal identifier * * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1167,10 +1170,10 @@ function ($response) { * Read participations breakdown by Marketing Event internal identifier * * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1221,10 +1224,10 @@ function ($exception) { * Create request for operation 'getParticipationsBreakdownByMarketingEventId' * * @param int $marketing_event_id The internal id of the marketing event in HubSpot. (required) - * @param string $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) - * @param string $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) - * @param int $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) - * @param string $after The cursor indicating the position of the last retrieved item. (optional) + * @param string|null $contact_identifier The identifier of the Contact. It may be email or internal id. (optional) + * @param string|null $state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW (optional) + * @param int|null $limit The limit for response size. The default value is 10, the max number is 100 (optional, default to 10) + * @param string|null $after The cursor indicating the position of the last retrieved item. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParticipationsBreakdownByMarketingEventId'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1415,18 +1418,6 @@ public function getParticipationsCountersByEventExternalIdWithHttpInfo($external $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1485,6 +1476,19 @@ public function getParticipationsCountersByEventExternalIdWithHttpInfo($external ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1779,18 +1783,6 @@ public function getParticipationsCountersByMarketingEventIdWithHttpInfo($marketi $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1849,6 +1841,19 @@ public function getParticipationsCountersByMarketingEventIdWithHttpInfo($marketi ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\AttendanceCounters'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Marketing/Events/Api/SettingsApi.php b/codegen/Marketing/Events/Api/SettingsApi.php index 077079ddb..98770965b 100644 --- a/codegen/Marketing/Events/Api/SettingsApi.php +++ b/codegen/Marketing/Events/Api/SettingsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class SettingsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -181,18 +181,6 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -251,6 +239,19 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\EventDetailSettings'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -530,18 +531,6 @@ public function updateWithHttpInfo($app_id, $event_detail_settings_url, string $ $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -600,6 +589,19 @@ public function updateWithHttpInfo($app_id, $event_detail_settings_url, string $ ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\EventDetailSettings'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php index dd93e7485..74324a310 100644 --- a/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php +++ b/codegen/Marketing/Events/Api/SubscriberStateChangesApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class SubscriberStateChangesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -130,9 +130,9 @@ public function getConfig() * * Record a subscriber state by contact email * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber batch_input_marketing_event_email_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * @@ -151,9 +151,9 @@ public function upsertByContactEmail($external_event_id, $subscriber_state, $ext * * Record a subscriber state by contact email * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * @@ -187,18 +187,6 @@ public function upsertByContactEmailWithHttpInfo($external_event_id, $subscriber $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { default: @@ -230,6 +218,19 @@ public function upsertByContactEmailWithHttpInfo($external_event_id, $subscriber ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -278,9 +279,9 @@ public function upsertByContactEmailWithHttpInfo($external_event_id, $subscriber * * Record a subscriber state by contact email * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * @@ -302,9 +303,9 @@ function ($response) { * * Record a subscriber state by contact email * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * @@ -355,9 +356,9 @@ function ($exception) { /** * Create request for operation 'upsertByContactEmail' * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventEmailSubscriber $batch_input_marketing_event_email_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactEmail'] to see the possible values for this operation * @@ -501,9 +502,9 @@ public function upsertByContactEmailRequest($external_event_id, $subscriber_stat * * Record a subscriber state by contact ID * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber batch_input_marketing_event_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * @@ -522,9 +523,9 @@ public function upsertByContactId($external_event_id, $subscriber_state, $extern * * Record a subscriber state by contact ID * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * @@ -558,18 +559,6 @@ public function upsertByContactIdWithHttpInfo($external_event_id, $subscriber_st $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { default: @@ -601,6 +590,19 @@ public function upsertByContactIdWithHttpInfo($external_event_id, $subscriber_st ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Events\Model\Error'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -649,9 +651,9 @@ public function upsertByContactIdWithHttpInfo($external_event_id, $subscriber_st * * Record a subscriber state by contact ID * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * @@ -673,9 +675,9 @@ function ($response) { * * Record a subscriber state by contact ID * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * @@ -726,9 +728,9 @@ function ($exception) { /** * Create request for operation 'upsertByContactId' * - * @param string $external_event_id The ID of the marketing event (required) + * @param string $external_event_id The id of the marketing event in the external event application (required) * @param string $subscriber_state The new subscriber state for the HubSpot contacts and the specified marketing event. For example: 'register', 'attend' or 'cancel'. (required) - * @param string $external_account_id The account ID associated with the marketing event (required) + * @param string $external_account_id The accountId that is associated with this marketing event in the external event application (required) * @param \HubSpot\Client\Marketing\Events\Model\BatchInputMarketingEventSubscriber $batch_input_marketing_event_subscriber (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByContactId'] to see the possible values for this operation * diff --git a/codegen/Marketing/Events/ApiException.php b/codegen/Marketing/Events/ApiException.php index 5cf35c9bf..bd2a62f0e 100644 --- a/codegen/Marketing/Events/ApiException.php +++ b/codegen/Marketing/Events/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Marketing/Events/Configuration.php b/codegen/Marketing/Events/Configuration.php index 5b02fa120..84e958096 100644 --- a/codegen/Marketing/Events/Configuration.php +++ b/codegen/Marketing/Events/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Marketing/Events/HeaderSelector.php b/codegen/Marketing/Events/HeaderSelector.php index e9ecfbf1e..73df0cae4 100644 --- a/codegen/Marketing/Events/HeaderSelector.php +++ b/codegen/Marketing/Events/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Marketing/Events/Model/AppInfo.php b/codegen/Marketing/Events/Model/AppInfo.php new file mode 100644 index 000000000..f7afdd6a3 --- /dev/null +++ b/codegen/Marketing/Events/Model/AppInfo.php @@ -0,0 +1,449 @@ + + */ +class AppInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AppInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/AttendanceCounters.php b/codegen/Marketing/Events/Model/AttendanceCounters.php index ca9a1d835..71c13cfe6 100644 --- a/codegen/Marketing/Events/Model/AttendanceCounters.php +++ b/codegen/Marketing/Events/Model/AttendanceCounters.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('attended', $data ?? [], null); $this->setIfExists('registered', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php index 30920db61..a18ebe2a2 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventCreateRequestParams.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php index b0e2ebffe..d078d77c7 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventEmailSubscriber.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php index cfb6dfe60..15a559cce 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventExternalUniqueIdentifier.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicObjectIdDeleteRequest.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicObjectIdDeleteRequest.php new file mode 100644 index 000000000..5f1a52b2e --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicObjectIdDeleteRequest.php @@ -0,0 +1,412 @@ + + */ +class BatchInputMarketingEventPublicObjectIdDeleteRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputMarketingEventPublicObjectIdDeleteRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicObjectIdDeleteRequest[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicObjectIdDeleteRequest[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicObjectIdDeleteRequest[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicUpdateRequestFullV2.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicUpdateRequestFullV2.php new file mode 100644 index 000000000..c5b572a49 --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventPublicUpdateRequestFullV2.php @@ -0,0 +1,412 @@ + + */ +class BatchInputMarketingEventPublicUpdateRequestFullV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchInputMarketingEventPublicUpdateRequestFullV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'inputs' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestFullV2[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'inputs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'inputs' => 'inputs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'inputs' => 'setInputs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'inputs' => 'getInputs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['inputs'] === null) { + $invalidProperties[] = "'inputs' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets inputs + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestFullV2[] + */ + public function getInputs() + { + return $this->container['inputs']; + } + + /** + * Sets inputs + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicUpdateRequestFullV2[] $inputs inputs + * + * @return self + */ + public function setInputs($inputs) + { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } + $this->container['inputs'] = $inputs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php b/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php index 72d6be3b7..16f99514a 100644 --- a/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php +++ b/codegen/Marketing/Events/Model/BatchInputMarketingEventSubscriber.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php index 57ebf1bc9..461f8e997 100644 --- a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php +++ b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2.php b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2.php new file mode 100644 index 000000000..bf7a8cbdf --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2.php @@ -0,0 +1,629 @@ + + */ +class BatchResponseMarketingEventPublicDefaultResponseV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseMarketingEventPublicDefaultResponseV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2WithErrors.php b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2WithErrors.php new file mode 100644 index 000000000..f91c55232 --- /dev/null +++ b/codegen/Marketing/Events/Model/BatchResponseMarketingEventPublicDefaultResponseV2WithErrors.php @@ -0,0 +1,697 @@ + + */ +class BatchResponseMarketingEventPublicDefaultResponseV2WithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseMarketingEventPublicDefaultResponseV2WithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'started_at' => '\DateTime', + 'links' => 'array', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[]', + 'errors' => '\HubSpot\Client\Marketing\Events\Model\StandardError[]', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'started_at' => 'date-time', + 'links' => null, + 'results' => null, + 'errors' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'started_at' => 'startedAt', + 'links' => 'links', + 'results' => 'results', + 'errors' => 'errors', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'started_at' => 'setStartedAt', + 'links' => 'setLinks', + 'results' => 'setResults', + 'errors' => 'setErrors', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'started_at' => 'getStartedAt', + 'links' => 'getLinks', + 'results' => 'getResults', + 'errors' => 'getErrors', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_PROCESSING, + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at completed_at + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors num_errors + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links links + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicDefaultResponseV2[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Marketing\Events\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Marketing\Events\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php b/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php index 350707ab0..0b086d902 100644 --- a/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php +++ b/codegen/Marketing/Events/Model/BatchResponseSubscriberEmailResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php b/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php index 95d874606..0a5afdb04 100644 --- a/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php +++ b/codegen/Marketing/Events/Model/BatchResponseSubscriberVidResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging.php b/codegen/Marketing/Events/Model/CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging.php new file mode 100644 index 000000000..3950186df --- /dev/null +++ b/codegen/Marketing/Events/Model/CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging.php @@ -0,0 +1,446 @@ + + */ +class CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paging' => '\HubSpot\Client\Marketing\Events\Model\ForwardPaging', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paging' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'paging' => 'paging', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paging' => 'setPaging', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paging' => 'getPaging', + 'results' => 'getResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets paging + * + * @return \HubSpot\Client\Marketing\Events\Model\ForwardPaging|null + */ + public function getPaging() + { + return $this->container['paging']; + } + + /** + * Sets paging + * + * @param \HubSpot\Client\Marketing\Events\Model\ForwardPaging|null $paging paging + * + * @return self + */ + public function setPaging($paging) + { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } + $this->container['paging'] = $paging; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventPublicReadResponseV2[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseSearchPublicResponseWrapperNoPaging.php similarity index 91% rename from codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php rename to codegen/Marketing/Events/Model/CollectionResponseSearchPublicResponseWrapperNoPaging.php index 8956680a7..9f85f1f2d 100644 --- a/codegen/Marketing/Events/Model/CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging.php +++ b/codegen/Marketing/Events/Model/CollectionResponseSearchPublicResponseWrapperNoPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseSearchPublicResponseWrapperNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging implement * * @var string */ - protected static $openAPIModelName = 'CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging'; + protected static $openAPIModelName = 'CollectionResponseSearchPublicResponseWrapperNoPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseMarketingEventExternalUniqueIdentifierNoPaging implement * @var string[] */ protected static $openAPITypes = [ - 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventExternalUniqueIdentifier[]' + 'results' => '\HubSpot\Client\Marketing\Events\Model\SearchPublicResponseWrapper[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets results * - * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventExternalUniqueIdentifier[] + * @return \HubSpot\Client\Marketing\Events\Model\SearchPublicResponseWrapper[] */ public function getResults() { @@ -305,7 +305,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventExternalUniqueIdentifier[] $results results + * @param \HubSpot\Client\Marketing\Events\Model\SearchPublicResponseWrapper[] $results results * * @return self */ diff --git a/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php new file mode 100644 index 000000000..97fa0fa97 --- /dev/null +++ b/codegen/Marketing/Events/Model/CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging.php @@ -0,0 +1,449 @@ + + */ +class CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'results' => '\HubSpot\Client\Marketing\Events\Model\MarketingEventIdentifiersResponse[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => 'int32', + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'total' => 'total', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'results' => 'getResults' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total total + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Marketing\Events\Model\MarketingEventIdentifiersResponse[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Marketing\Events\Model\MarketingEventIdentifiersResponse[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php index aae00c9b1..dc2420ed3 100644 --- a/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php +++ b/codegen/Marketing/Events/Model/CollectionResponseWithTotalParticipationBreakdownForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php b/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php index 178b064f0..2292d8d66 100644 --- a/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php +++ b/codegen/Marketing/Events/Model/CollectionResponseWithTotalPublicListNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/ContactAssociation.php b/codegen/Marketing/Events/Model/ContactAssociation.php index 0e13c250b..b1f56f4ef 100644 --- a/codegen/Marketing/Events/Model/ContactAssociation.php +++ b/codegen/Marketing/Events/Model/ContactAssociation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('firstname', $data ?? [], null); $this->setIfExists('contact_id', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/CrmPropertyWrapper.php b/codegen/Marketing/Events/Model/CrmPropertyWrapper.php new file mode 100644 index 000000000..b53ea2307 --- /dev/null +++ b/codegen/Marketing/Events/Model/CrmPropertyWrapper.php @@ -0,0 +1,449 @@ + + */ +class CrmPropertyWrapper implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CrmPropertyWrapper'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/Error.php b/codegen/Marketing/Events/Model/Error.php index 52717870f..127570980 100644 --- a/codegen/Marketing/Events/Model/Error.php +++ b/codegen/Marketing/Events/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/ErrorDetail.php b/codegen/Marketing/Events/Model/ErrorDetail.php index 87ca0704f..3c6b53407 100644 --- a/codegen/Marketing/Events/Model/ErrorDetail.php +++ b/codegen/Marketing/Events/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/EventDetailSettings.php b/codegen/Marketing/Events/Model/EventDetailSettings.php index 9da8c5ece..189ded874 100644 --- a/codegen/Marketing/Events/Model/EventDetailSettings.php +++ b/codegen/Marketing/Events/Model/EventDetailSettings.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('app_id', $data ?? [], null); $this->setIfExists('event_details_url', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php b/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php index 444344966..fa6e72076 100644 --- a/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php +++ b/codegen/Marketing/Events/Model/EventDetailSettingsUrl.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_details_url', $data ?? [], null); } diff --git a/codegen/Marketing/Events/Model/ForwardPaging.php b/codegen/Marketing/Events/Model/ForwardPaging.php index ad774cefc..194c92db3 100644 --- a/codegen/Marketing/Events/Model/ForwardPaging.php +++ b/codegen/Marketing/Events/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Marketing/Events/Model/MarketingEventAssociation.php b/codegen/Marketing/Events/Model/MarketingEventAssociation.php index 611df3db4..3317026a6 100644 --- a/codegen/Marketing/Events/Model/MarketingEventAssociation.php +++ b/codegen/Marketing/Events/Model/MarketingEventAssociation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('external_account_id', $data ?? [], null); $this->setIfExists('marketing_event_id', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php b/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php index 93def327f..90c491a4c 100644 --- a/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php +++ b/codegen/Marketing/Events/Model/MarketingEventCompleteRequestParams.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('start_date_time', $data ?? [], null); $this->setIfExists('end_date_time', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php b/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php index 473486870..53765c28a 100644 --- a/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php +++ b/codegen/Marketing/Events/Model/MarketingEventCreateRequestParams.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -305,10 +305,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('start_date_time', $data ?? [], null); $this->setIfExists('custom_properties', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php b/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php index 6b89ec804..c8ea6a54b 100644 --- a/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventDefaultResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -66,7 +66,8 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_name' => 'string', 'event_type' => 'string', 'event_completed' => 'bool', - 'end_date_time' => '\DateTime' + 'end_date_time' => '\DateTime', + 'object_id' => 'string' ]; /** @@ -86,7 +87,8 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_name' => null, 'event_type' => null, 'event_completed' => null, - 'end_date_time' => 'date-time' + 'end_date_time' => 'date-time', + 'object_id' => null ]; /** @@ -104,7 +106,8 @@ class MarketingEventDefaultResponse implements ModelInterface, ArrayAccess, \Jso 'event_name' => false, 'event_type' => false, 'event_completed' => false, - 'end_date_time' => false + 'end_date_time' => false, + 'object_id' => false ]; /** @@ -202,7 +205,8 @@ public function isNullableSetToNull(string $property): bool 'event_name' => 'eventName', 'event_type' => 'eventType', 'event_completed' => 'eventCompleted', - 'end_date_time' => 'endDateTime' + 'end_date_time' => 'endDateTime', + 'object_id' => 'objectId' ]; /** @@ -220,7 +224,8 @@ public function isNullableSetToNull(string $property): bool 'event_name' => 'setEventName', 'event_type' => 'setEventType', 'event_completed' => 'setEventCompleted', - 'end_date_time' => 'setEndDateTime' + 'end_date_time' => 'setEndDateTime', + 'object_id' => 'setObjectId' ]; /** @@ -238,7 +243,8 @@ public function isNullableSetToNull(string $property): bool 'event_name' => 'getEventName', 'event_type' => 'getEventType', 'event_completed' => 'getEventCompleted', - 'end_date_time' => 'getEndDateTime' + 'end_date_time' => 'getEndDateTime', + 'object_id' => 'getObjectId' ]; /** @@ -293,10 +299,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('start_date_time', $data ?? [], null); $this->setIfExists('custom_properties', $data ?? [], null); @@ -308,6 +314,7 @@ public function __construct(array $data = null) $this->setIfExists('event_type', $data ?? [], null); $this->setIfExists('event_completed', $data ?? [], null); $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); } /** @@ -627,6 +634,33 @@ public function setEndDateTime($end_date_time) return $this; } + + /** + * Gets object_id + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string|null $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php b/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php index 6fe365ec0..ef1d1b774 100644 --- a/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php +++ b/codegen/Marketing/Events/Model/MarketingEventEmailSubscriber.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('contact_properties', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); @@ -410,7 +410,7 @@ public function getInteractionDateTime() /** * Sets interaction_date_time * - * @param int $interaction_date_time The date and time at which the contact subscribed to the event. + * @param int $interaction_date_time Timestamp in milliseconds at which the contact subscribed to the event. * * @return self */ diff --git a/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php b/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php index 9e970aa8c..a7f257611 100644 --- a/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php +++ b/codegen/Marketing/Events/Model/MarketingEventExternalUniqueIdentifier.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('external_account_id', $data ?? [], null); $this->setIfExists('external_event_id', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/MarketingEventIdentifiersResponse.php b/codegen/Marketing/Events/Model/MarketingEventIdentifiersResponse.php new file mode 100644 index 000000000..868c30ad0 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventIdentifiersResponse.php @@ -0,0 +1,554 @@ + + */ +class MarketingEventIdentifiersResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventIdentifiersResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'external_account_id' => 'string', + 'external_event_id' => 'string', + 'app_info' => '\HubSpot\Client\Marketing\Events\Model\AppInfo', + 'object_id' => 'string', + 'marketing_event_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'external_account_id' => null, + 'external_event_id' => null, + 'app_info' => null, + 'object_id' => null, + 'marketing_event_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'external_account_id' => false, + 'external_event_id' => false, + 'app_info' => false, + 'object_id' => false, + 'marketing_event_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'external_account_id' => 'externalAccountId', + 'external_event_id' => 'externalEventId', + 'app_info' => 'appInfo', + 'object_id' => 'objectId', + 'marketing_event_name' => 'marketingEventName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'external_account_id' => 'setExternalAccountId', + 'external_event_id' => 'setExternalEventId', + 'app_info' => 'setAppInfo', + 'object_id' => 'setObjectId', + 'marketing_event_name' => 'setMarketingEventName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'external_account_id' => 'getExternalAccountId', + 'external_event_id' => 'getExternalEventId', + 'app_info' => 'getAppInfo', + 'object_id' => 'getObjectId', + 'marketing_event_name' => 'getMarketingEventName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('external_account_id', $data ?? [], null); + $this->setIfExists('external_event_id', $data ?? [], null); + $this->setIfExists('app_info', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('marketing_event_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['external_event_id'] === null) { + $invalidProperties[] = "'external_event_id' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + if ($this->container['marketing_event_name'] === null) { + $invalidProperties[] = "'marketing_event_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets external_account_id + * + * @return string|null + */ + public function getExternalAccountId() + { + return $this->container['external_account_id']; + } + + /** + * Sets external_account_id + * + * @param string|null $external_account_id external_account_id + * + * @return self + */ + public function setExternalAccountId($external_account_id) + { + if (is_null($external_account_id)) { + throw new \InvalidArgumentException('non-nullable external_account_id cannot be null'); + } + $this->container['external_account_id'] = $external_account_id; + + return $this; + } + + /** + * Gets external_event_id + * + * @return string + */ + public function getExternalEventId() + { + return $this->container['external_event_id']; + } + + /** + * Sets external_event_id + * + * @param string $external_event_id external_event_id + * + * @return self + */ + public function setExternalEventId($external_event_id) + { + if (is_null($external_event_id)) { + throw new \InvalidArgumentException('non-nullable external_event_id cannot be null'); + } + $this->container['external_event_id'] = $external_event_id; + + return $this; + } + + /** + * Gets app_info + * + * @return \HubSpot\Client\Marketing\Events\Model\AppInfo|null + */ + public function getAppInfo() + { + return $this->container['app_info']; + } + + /** + * Sets app_info + * + * @param \HubSpot\Client\Marketing\Events\Model\AppInfo|null $app_info app_info + * + * @return self + */ + public function setAppInfo($app_info) + { + if (is_null($app_info)) { + throw new \InvalidArgumentException('non-nullable app_info cannot be null'); + } + $this->container['app_info'] = $app_info; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + + /** + * Gets marketing_event_name + * + * @return string + */ + public function getMarketingEventName() + { + return $this->container['marketing_event_name']; + } + + /** + * Sets marketing_event_name + * + * @param string $marketing_event_name marketing_event_name + * + * @return self + */ + public function setMarketingEventName($marketing_event_name) + { + if (is_null($marketing_event_name)) { + throw new \InvalidArgumentException('non-nullable marketing_event_name cannot be null'); + } + $this->container['marketing_event_name'] = $marketing_event_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php index 3ca1d7c7b..d22877751 100644 --- a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -69,6 +69,7 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess 'event_description' => 'string', 'event_name' => 'string', 'id' => 'string', + 'object_id' => 'string', 'updated_at' => '\DateTime' ]; @@ -92,6 +93,7 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess 'event_description' => null, 'event_name' => null, 'id' => null, + 'object_id' => null, 'updated_at' => 'date-time' ]; @@ -113,6 +115,7 @@ class MarketingEventPublicDefaultResponse implements ModelInterface, ArrayAccess 'event_description' => false, 'event_name' => false, 'id' => false, + 'object_id' => false, 'updated_at' => false ]; @@ -214,6 +217,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'eventDescription', 'event_name' => 'eventName', 'id' => 'id', + 'object_id' => 'objectId', 'updated_at' => 'updatedAt' ]; @@ -235,6 +239,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', 'id' => 'setId', + 'object_id' => 'setObjectId', 'updated_at' => 'setUpdatedAt' ]; @@ -256,6 +261,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', 'id' => 'getId', + 'object_id' => 'getObjectId', 'updated_at' => 'getUpdatedAt' ]; @@ -311,10 +317,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_organizer', $data ?? [], null); $this->setIfExists('event_url', $data ?? [], null); @@ -328,6 +334,7 @@ public function __construct(array $data = null) $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -712,6 +719,33 @@ public function setId($id) return $this; } + /** + * Gets object_id + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string|null $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** * Gets updated_at * diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponseV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponseV2.php new file mode 100644 index 000000000..9ed9aa704 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicDefaultResponseV2.php @@ -0,0 +1,866 @@ + + */ +class MarketingEventPublicDefaultResponseV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicDefaultResponseV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event_organizer' => 'string', + 'event_url' => 'string', + 'app_info' => '\HubSpot\Client\Marketing\Events\Model\AppInfo', + 'event_type' => 'string', + 'event_completed' => 'bool', + 'end_date_time' => '\DateTime', + 'created_at' => '\DateTime', + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[]', + 'event_cancelled' => 'bool', + 'event_description' => 'string', + 'event_name' => 'string', + 'object_id' => 'string', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event_organizer' => null, + 'event_url' => null, + 'app_info' => null, + 'event_type' => null, + 'event_completed' => null, + 'end_date_time' => 'date-time', + 'created_at' => 'date-time', + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'event_description' => null, + 'event_name' => null, + 'object_id' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event_organizer' => false, + 'event_url' => false, + 'app_info' => false, + 'event_type' => false, + 'event_completed' => false, + 'end_date_time' => false, + 'created_at' => false, + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'event_description' => false, + 'event_name' => false, + 'object_id' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'app_info' => 'appInfo', + 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', + 'end_date_time' => 'endDateTime', + 'created_at' => 'createdAt', + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'object_id' => 'objectId', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'app_info' => 'setAppInfo', + 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', + 'end_date_time' => 'setEndDateTime', + 'created_at' => 'setCreatedAt', + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'object_id' => 'setObjectId', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'app_info' => 'getAppInfo', + 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', + 'end_date_time' => 'getEndDateTime', + 'created_at' => 'getCreatedAt', + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'object_id' => 'getObjectId', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('app_info', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets app_info + * + * @return \HubSpot\Client\Marketing\Events\Model\AppInfo|null + */ + public function getAppInfo() + { + return $this->container['app_info']; + } + + /** + * Sets app_info + * + * @param \HubSpot\Client\Marketing\Events\Model\AppInfo|null $app_info app_info + * + * @return self + */ + public function setAppInfo($app_info) + { + if (is_null($app_info)) { + throw new \InvalidArgumentException('non-nullable app_info cannot be null'); + } + $this->container['app_info'] = $app_info; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicObjectIdDeleteRequest.php b/codegen/Marketing/Events/Model/MarketingEventPublicObjectIdDeleteRequest.php new file mode 100644 index 000000000..977a9ec40 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicObjectIdDeleteRequest.php @@ -0,0 +1,412 @@ + + */ +class MarketingEventPublicObjectIdDeleteRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicObjectIdDeleteRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'object_id' => 'objectId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object_id' => 'setObjectId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object_id' => 'getObjectId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php index 8d583b15b..426bce3d6 100644 --- a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php +++ b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -74,6 +74,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_description' => 'string', 'event_name' => 'string', 'id' => 'string', + 'object_id' => 'string', 'updated_at' => '\DateTime' ]; @@ -102,6 +103,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_description' => null, 'event_name' => null, 'id' => null, + 'object_id' => null, 'updated_at' => 'date-time' ]; @@ -128,6 +130,7 @@ class MarketingEventPublicReadResponse implements ModelInterface, ArrayAccess, \ 'event_description' => false, 'event_name' => false, 'id' => false, + 'object_id' => false, 'updated_at' => false ]; @@ -234,6 +237,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'eventDescription', 'event_name' => 'eventName', 'id' => 'id', + 'object_id' => 'objectId', 'updated_at' => 'updatedAt' ]; @@ -260,6 +264,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'setEventDescription', 'event_name' => 'setEventName', 'id' => 'setId', + 'object_id' => 'setObjectId', 'updated_at' => 'setUpdatedAt' ]; @@ -286,6 +291,7 @@ public function isNullableSetToNull(string $property): bool 'event_description' => 'getEventDescription', 'event_name' => 'getEventName', 'id' => 'getId', + 'object_id' => 'getObjectId', 'updated_at' => 'getUpdatedAt' ]; @@ -341,10 +347,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('registrants', $data ?? [], null); $this->setIfExists('event_organizer', $data ?? [], null); @@ -363,6 +369,7 @@ public function __construct(array $data = null) $this->setIfExists('event_description', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -897,6 +904,33 @@ public function setId($id) return $this; } + /** + * Gets object_id + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string|null $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** * Gets updated_at * diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicReadResponseV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponseV2.php new file mode 100644 index 000000000..39289756c --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicReadResponseV2.php @@ -0,0 +1,1070 @@ + + */ +class MarketingEventPublicReadResponseV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicReadResponseV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'registrants' => 'int', + 'event_organizer' => 'string', + 'event_url' => 'string', + 'attendees' => 'int', + 'app_info' => '\HubSpot\Client\Marketing\Events\Model\AppInfo', + 'event_type' => 'string', + 'event_completed' => 'bool', + 'end_date_time' => '\DateTime', + 'no_shows' => 'int', + 'cancellations' => 'int', + 'created_at' => '\DateTime', + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[]', + 'event_cancelled' => 'bool', + 'external_event_id' => 'string', + 'event_status' => 'string', + 'event_description' => 'string', + 'event_name' => 'string', + 'object_id' => 'string', + 'updated_at' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'registrants' => 'int32', + 'event_organizer' => null, + 'event_url' => null, + 'attendees' => 'int32', + 'app_info' => null, + 'event_type' => null, + 'event_completed' => null, + 'end_date_time' => 'date-time', + 'no_shows' => 'int32', + 'cancellations' => 'int32', + 'created_at' => 'date-time', + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'external_event_id' => null, + 'event_status' => null, + 'event_description' => null, + 'event_name' => null, + 'object_id' => null, + 'updated_at' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'registrants' => false, + 'event_organizer' => false, + 'event_url' => false, + 'attendees' => false, + 'app_info' => false, + 'event_type' => false, + 'event_completed' => false, + 'end_date_time' => false, + 'no_shows' => false, + 'cancellations' => false, + 'created_at' => false, + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'external_event_id' => false, + 'event_status' => false, + 'event_description' => false, + 'event_name' => false, + 'object_id' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'registrants' => 'registrants', + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'attendees' => 'attendees', + 'app_info' => 'appInfo', + 'event_type' => 'eventType', + 'event_completed' => 'eventCompleted', + 'end_date_time' => 'endDateTime', + 'no_shows' => 'noShows', + 'cancellations' => 'cancellations', + 'created_at' => 'createdAt', + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'external_event_id' => 'externalEventId', + 'event_status' => 'eventStatus', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'object_id' => 'objectId', + 'updated_at' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'registrants' => 'setRegistrants', + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'attendees' => 'setAttendees', + 'app_info' => 'setAppInfo', + 'event_type' => 'setEventType', + 'event_completed' => 'setEventCompleted', + 'end_date_time' => 'setEndDateTime', + 'no_shows' => 'setNoShows', + 'cancellations' => 'setCancellations', + 'created_at' => 'setCreatedAt', + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'external_event_id' => 'setExternalEventId', + 'event_status' => 'setEventStatus', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'object_id' => 'setObjectId', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'registrants' => 'getRegistrants', + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'attendees' => 'getAttendees', + 'app_info' => 'getAppInfo', + 'event_type' => 'getEventType', + 'event_completed' => 'getEventCompleted', + 'end_date_time' => 'getEndDateTime', + 'no_shows' => 'getNoShows', + 'cancellations' => 'getCancellations', + 'created_at' => 'getCreatedAt', + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'external_event_id' => 'getExternalEventId', + 'event_status' => 'getEventStatus', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'object_id' => 'getObjectId', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('registrants', $data ?? [], null); + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('attendees', $data ?? [], null); + $this->setIfExists('app_info', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_completed', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('no_shows', $data ?? [], null); + $this->setIfExists('cancellations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('external_event_id', $data ?? [], null); + $this->setIfExists('event_status', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + if ($this->container['event_name'] === null) { + $invalidProperties[] = "'event_name' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets registrants + * + * @return int|null + */ + public function getRegistrants() + { + return $this->container['registrants']; + } + + /** + * Sets registrants + * + * @param int|null $registrants registrants + * + * @return self + */ + public function setRegistrants($registrants) + { + if (is_null($registrants)) { + throw new \InvalidArgumentException('non-nullable registrants cannot be null'); + } + $this->container['registrants'] = $registrants; + + return $this; + } + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets attendees + * + * @return int|null + */ + public function getAttendees() + { + return $this->container['attendees']; + } + + /** + * Sets attendees + * + * @param int|null $attendees attendees + * + * @return self + */ + public function setAttendees($attendees) + { + if (is_null($attendees)) { + throw new \InvalidArgumentException('non-nullable attendees cannot be null'); + } + $this->container['attendees'] = $attendees; + + return $this; + } + + /** + * Gets app_info + * + * @return \HubSpot\Client\Marketing\Events\Model\AppInfo|null + */ + public function getAppInfo() + { + return $this->container['app_info']; + } + + /** + * Sets app_info + * + * @param \HubSpot\Client\Marketing\Events\Model\AppInfo|null $app_info app_info + * + * @return self + */ + public function setAppInfo($app_info) + { + if (is_null($app_info)) { + throw new \InvalidArgumentException('non-nullable app_info cannot be null'); + } + $this->container['app_info'] = $app_info; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_completed + * + * @return bool|null + */ + public function getEventCompleted() + { + return $this->container['event_completed']; + } + + /** + * Sets event_completed + * + * @param bool|null $event_completed event_completed + * + * @return self + */ + public function setEventCompleted($event_completed) + { + if (is_null($event_completed)) { + throw new \InvalidArgumentException('non-nullable event_completed cannot be null'); + } + $this->container['event_completed'] = $event_completed; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + + /** + * Gets no_shows + * + * @return int|null + */ + public function getNoShows() + { + return $this->container['no_shows']; + } + + /** + * Sets no_shows + * + * @param int|null $no_shows no_shows + * + * @return self + */ + public function setNoShows($no_shows) + { + if (is_null($no_shows)) { + throw new \InvalidArgumentException('non-nullable no_shows cannot be null'); + } + $this->container['no_shows'] = $no_shows; + + return $this; + } + + /** + * Gets cancellations + * + * @return int|null + */ + public function getCancellations() + { + return $this->container['cancellations']; + } + + /** + * Sets cancellations + * + * @param int|null $cancellations cancellations + * + * @return self + */ + public function setCancellations($cancellations) + { + if (is_null($cancellations)) { + throw new \InvalidArgumentException('non-nullable cancellations cannot be null'); + } + $this->container['cancellations'] = $cancellations; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\CrmPropertyWrapper[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets external_event_id + * + * @return string|null + */ + public function getExternalEventId() + { + return $this->container['external_event_id']; + } + + /** + * Sets external_event_id + * + * @param string|null $external_event_id external_event_id + * + * @return self + */ + public function setExternalEventId($external_event_id) + { + if (is_null($external_event_id)) { + throw new \InvalidArgumentException('non-nullable external_event_id cannot be null'); + } + $this->container['external_event_id'] = $external_event_id; + + return $this; + } + + /** + * Gets event_status + * + * @return string|null + */ + public function getEventStatus() + { + return $this->container['event_status']; + } + + /** + * Sets event_status + * + * @param string|null $event_status event_status + * + * @return self + */ + public function setEventStatus($event_status) + { + if (is_null($event_status)) { + throw new \InvalidArgumentException('non-nullable event_status cannot be null'); + } + $this->container['event_status'] = $event_status; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestFullV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestFullV2.php new file mode 100644 index 000000000..252dcf2e0 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestFullV2.php @@ -0,0 +1,721 @@ + + */ +class MarketingEventPublicUpdateRequestFullV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicUpdateRequestFullV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\PropertyValue[]', + 'event_cancelled' => 'bool', + 'event_organizer' => 'string', + 'event_url' => 'string', + 'event_description' => 'string', + 'event_name' => 'string', + 'event_type' => 'string', + 'end_date_time' => '\DateTime', + 'object_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'event_organizer' => null, + 'event_url' => null, + 'event_description' => null, + 'event_name' => null, + 'event_type' => null, + 'end_date_time' => 'date-time', + 'object_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'event_organizer' => false, + 'event_url' => false, + 'event_description' => false, + 'event_name' => false, + 'event_type' => false, + 'end_date_time' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'event_type' => 'eventType', + 'end_date_time' => 'endDateTime', + 'object_id' => 'objectId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'event_type' => 'setEventType', + 'end_date_time' => 'setEndDateTime', + 'object_id' => 'setObjectId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'event_type' => 'getEventType', + 'end_date_time' => 'getEndDateTime', + 'object_id' => 'getObjectId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\PropertyValue[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\PropertyValue[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string|null + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string|null $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestV2.php b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestV2.php new file mode 100644 index 000000000..05b736733 --- /dev/null +++ b/codegen/Marketing/Events/Model/MarketingEventPublicUpdateRequestV2.php @@ -0,0 +1,684 @@ + + */ +class MarketingEventPublicUpdateRequestV2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MarketingEventPublicUpdateRequestV2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start_date_time' => '\DateTime', + 'custom_properties' => '\HubSpot\Client\Marketing\Events\Model\PropertyValue[]', + 'event_cancelled' => 'bool', + 'event_organizer' => 'string', + 'event_url' => 'string', + 'event_description' => 'string', + 'event_name' => 'string', + 'event_type' => 'string', + 'end_date_time' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start_date_time' => 'date-time', + 'custom_properties' => null, + 'event_cancelled' => null, + 'event_organizer' => null, + 'event_url' => null, + 'event_description' => null, + 'event_name' => null, + 'event_type' => null, + 'end_date_time' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_date_time' => false, + 'custom_properties' => false, + 'event_cancelled' => false, + 'event_organizer' => false, + 'event_url' => false, + 'event_description' => false, + 'event_name' => false, + 'event_type' => false, + 'end_date_time' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'start_date_time' => 'startDateTime', + 'custom_properties' => 'customProperties', + 'event_cancelled' => 'eventCancelled', + 'event_organizer' => 'eventOrganizer', + 'event_url' => 'eventUrl', + 'event_description' => 'eventDescription', + 'event_name' => 'eventName', + 'event_type' => 'eventType', + 'end_date_time' => 'endDateTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start_date_time' => 'setStartDateTime', + 'custom_properties' => 'setCustomProperties', + 'event_cancelled' => 'setEventCancelled', + 'event_organizer' => 'setEventOrganizer', + 'event_url' => 'setEventUrl', + 'event_description' => 'setEventDescription', + 'event_name' => 'setEventName', + 'event_type' => 'setEventType', + 'end_date_time' => 'setEndDateTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start_date_time' => 'getStartDateTime', + 'custom_properties' => 'getCustomProperties', + 'event_cancelled' => 'getEventCancelled', + 'event_organizer' => 'getEventOrganizer', + 'event_url' => 'getEventUrl', + 'event_description' => 'getEventDescription', + 'event_name' => 'getEventName', + 'event_type' => 'getEventType', + 'end_date_time' => 'getEndDateTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('start_date_time', $data ?? [], null); + $this->setIfExists('custom_properties', $data ?? [], null); + $this->setIfExists('event_cancelled', $data ?? [], null); + $this->setIfExists('event_organizer', $data ?? [], null); + $this->setIfExists('event_url', $data ?? [], null); + $this->setIfExists('event_description', $data ?? [], null); + $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('end_date_time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['custom_properties'] === null) { + $invalidProperties[] = "'custom_properties' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets start_date_time + * + * @return \DateTime|null + */ + public function getStartDateTime() + { + return $this->container['start_date_time']; + } + + /** + * Sets start_date_time + * + * @param \DateTime|null $start_date_time start_date_time + * + * @return self + */ + public function setStartDateTime($start_date_time) + { + if (is_null($start_date_time)) { + throw new \InvalidArgumentException('non-nullable start_date_time cannot be null'); + } + $this->container['start_date_time'] = $start_date_time; + + return $this; + } + + /** + * Gets custom_properties + * + * @return \HubSpot\Client\Marketing\Events\Model\PropertyValue[] + */ + public function getCustomProperties() + { + return $this->container['custom_properties']; + } + + /** + * Sets custom_properties + * + * @param \HubSpot\Client\Marketing\Events\Model\PropertyValue[] $custom_properties custom_properties + * + * @return self + */ + public function setCustomProperties($custom_properties) + { + if (is_null($custom_properties)) { + throw new \InvalidArgumentException('non-nullable custom_properties cannot be null'); + } + $this->container['custom_properties'] = $custom_properties; + + return $this; + } + + /** + * Gets event_cancelled + * + * @return bool|null + */ + public function getEventCancelled() + { + return $this->container['event_cancelled']; + } + + /** + * Sets event_cancelled + * + * @param bool|null $event_cancelled event_cancelled + * + * @return self + */ + public function setEventCancelled($event_cancelled) + { + if (is_null($event_cancelled)) { + throw new \InvalidArgumentException('non-nullable event_cancelled cannot be null'); + } + $this->container['event_cancelled'] = $event_cancelled; + + return $this; + } + + /** + * Gets event_organizer + * + * @return string|null + */ + public function getEventOrganizer() + { + return $this->container['event_organizer']; + } + + /** + * Sets event_organizer + * + * @param string|null $event_organizer event_organizer + * + * @return self + */ + public function setEventOrganizer($event_organizer) + { + if (is_null($event_organizer)) { + throw new \InvalidArgumentException('non-nullable event_organizer cannot be null'); + } + $this->container['event_organizer'] = $event_organizer; + + return $this; + } + + /** + * Gets event_url + * + * @return string|null + */ + public function getEventUrl() + { + return $this->container['event_url']; + } + + /** + * Sets event_url + * + * @param string|null $event_url event_url + * + * @return self + */ + public function setEventUrl($event_url) + { + if (is_null($event_url)) { + throw new \InvalidArgumentException('non-nullable event_url cannot be null'); + } + $this->container['event_url'] = $event_url; + + return $this; + } + + /** + * Gets event_description + * + * @return string|null + */ + public function getEventDescription() + { + return $this->container['event_description']; + } + + /** + * Sets event_description + * + * @param string|null $event_description event_description + * + * @return self + */ + public function setEventDescription($event_description) + { + if (is_null($event_description)) { + throw new \InvalidArgumentException('non-nullable event_description cannot be null'); + } + $this->container['event_description'] = $event_description; + + return $this; + } + + /** + * Gets event_name + * + * @return string|null + */ + public function getEventName() + { + return $this->container['event_name']; + } + + /** + * Sets event_name + * + * @param string|null $event_name event_name + * + * @return self + */ + public function setEventName($event_name) + { + if (is_null($event_name)) { + throw new \InvalidArgumentException('non-nullable event_name cannot be null'); + } + $this->container['event_name'] = $event_name; + + return $this; + } + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType() + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type event_type + * + * @return self + */ + public function setEventType($event_type) + { + if (is_null($event_type)) { + throw new \InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets end_date_time + * + * @return \DateTime|null + */ + public function getEndDateTime() + { + return $this->container['end_date_time']; + } + + /** + * Sets end_date_time + * + * @param \DateTime|null $end_date_time end_date_time + * + * @return self + */ + public function setEndDateTime($end_date_time) + { + if (is_null($end_date_time)) { + throw new \InvalidArgumentException('non-nullable end_date_time cannot be null'); + } + $this->container['end_date_time'] = $end_date_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/MarketingEventSubscriber.php b/codegen/Marketing/Events/Model/MarketingEventSubscriber.php index c1c989c11..6e035d3bd 100644 --- a/codegen/Marketing/Events/Model/MarketingEventSubscriber.php +++ b/codegen/Marketing/Events/Model/MarketingEventSubscriber.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('vid', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); @@ -373,7 +373,7 @@ public function getInteractionDateTime() /** * Sets interaction_date_time * - * @param int $interaction_date_time The date and time at which the contact subscribed to the event. + * @param int $interaction_date_time Timestamp in milliseconds at which the contact subscribed to the event. * * @return self */ diff --git a/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php b/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php index e974bae69..124b47021 100644 --- a/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php +++ b/codegen/Marketing/Events/Model/MarketingEventUpdateRequestParams.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -293,10 +293,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('start_date_time', $data ?? [], null); $this->setIfExists('custom_properties', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/ModelInterface.php b/codegen/Marketing/Events/Model/ModelInterface.php index 59e6c9b62..bf01195df 100644 --- a/codegen/Marketing/Events/Model/ModelInterface.php +++ b/codegen/Marketing/Events/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Marketing/Events/Model/NextPage.php b/codegen/Marketing/Events/Model/NextPage.php index bb9111cc9..b379e343b 100644 --- a/codegen/Marketing/Events/Model/NextPage.php +++ b/codegen/Marketing/Events/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/ParticipationAssociations.php b/codegen/Marketing/Events/Model/ParticipationAssociations.php index 1b1115871..b635a4c49 100644 --- a/codegen/Marketing/Events/Model/ParticipationAssociations.php +++ b/codegen/Marketing/Events/Model/ParticipationAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('marketing_event', $data ?? [], null); $this->setIfExists('contact', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/ParticipationBreakdown.php b/codegen/Marketing/Events/Model/ParticipationBreakdown.php index 4ae136f10..52ab5f3cd 100644 --- a/codegen/Marketing/Events/Model/ParticipationBreakdown.php +++ b/codegen/Marketing/Events/Model/ParticipationBreakdown.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/ParticipationProperties.php b/codegen/Marketing/Events/Model/ParticipationProperties.php index 1d12c986a..5ff5fce4f 100644 --- a/codegen/Marketing/Events/Model/ParticipationProperties.php +++ b/codegen/Marketing/Events/Model/ParticipationProperties.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -278,10 +278,10 @@ public function getAttendanceStateAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('occurred_at', $data ?? [], null); $this->setIfExists('attendance_percentage', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/PropertyValue.php b/codegen/Marketing/Events/Model/PropertyValue.php index 2e8b0ac7e..93ffe8472 100644 --- a/codegen/Marketing/Events/Model/PropertyValue.php +++ b/codegen/Marketing/Events/Model/PropertyValue.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -421,6 +421,7 @@ public function getModelName() public const SOURCE_MICROAPPS = 'MICROAPPS'; public const SOURCE_INTENT = 'INTENT'; public const SOURCE_PROSPECTING_AGENT = 'PROSPECTING_AGENT'; + public const SOURCE_CENTRAL_EXCHANGE_RATES = 'CENTRAL_EXCHANGE_RATES'; public const DATA_SENSITIVITY_NONE = 'none'; public const DATA_SENSITIVITY_STANDARD = 'standard'; public const DATA_SENSITIVITY_HIGH = 'high'; @@ -524,6 +525,7 @@ public function getSourceAllowableValues() self::SOURCE_MICROAPPS, self::SOURCE_INTENT, self::SOURCE_PROSPECTING_AGENT, + self::SOURCE_CENTRAL_EXCHANGE_RATES, ]; } @@ -551,10 +553,10 @@ public function getDataSensitivityAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('selected_by_user', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/PublicList.php b/codegen/Marketing/Events/Model/PublicList.php index 863ab8435..85b6ca939 100644 --- a/codegen/Marketing/Events/Model/PublicList.php +++ b/codegen/Marketing/Events/Model/PublicList.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -311,10 +311,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('processing_type', $data ?? [], null); $this->setIfExists('object_type_id', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/SearchPublicResponseWrapper.php b/codegen/Marketing/Events/Model/SearchPublicResponseWrapper.php new file mode 100644 index 000000000..8f5d15e26 --- /dev/null +++ b/codegen/Marketing/Events/Model/SearchPublicResponseWrapper.php @@ -0,0 +1,523 @@ + + */ +class SearchPublicResponseWrapper implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SearchPublicResponseWrapper'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'external_account_id' => 'string', + 'external_event_id' => 'string', + 'app_id' => 'int', + 'object_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'external_account_id' => null, + 'external_event_id' => null, + 'app_id' => 'int32', + 'object_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'external_account_id' => false, + 'external_event_id' => false, + 'app_id' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'external_account_id' => 'externalAccountId', + 'external_event_id' => 'externalEventId', + 'app_id' => 'appId', + 'object_id' => 'objectId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'external_account_id' => 'setExternalAccountId', + 'external_event_id' => 'setExternalEventId', + 'app_id' => 'setAppId', + 'object_id' => 'setObjectId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'external_account_id' => 'getExternalAccountId', + 'external_event_id' => 'getExternalEventId', + 'app_id' => 'getAppId', + 'object_id' => 'getObjectId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('external_account_id', $data ?? [], null); + $this->setIfExists('external_event_id', $data ?? [], null); + $this->setIfExists('app_id', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['external_account_id'] === null) { + $invalidProperties[] = "'external_account_id' can't be null"; + } + if ($this->container['external_event_id'] === null) { + $invalidProperties[] = "'external_event_id' can't be null"; + } + if ($this->container['app_id'] === null) { + $invalidProperties[] = "'app_id' can't be null"; + } + if ($this->container['object_id'] === null) { + $invalidProperties[] = "'object_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets external_account_id + * + * @return string + */ + public function getExternalAccountId() + { + return $this->container['external_account_id']; + } + + /** + * Sets external_account_id + * + * @param string $external_account_id external_account_id + * + * @return self + */ + public function setExternalAccountId($external_account_id) + { + if (is_null($external_account_id)) { + throw new \InvalidArgumentException('non-nullable external_account_id cannot be null'); + } + $this->container['external_account_id'] = $external_account_id; + + return $this; + } + + /** + * Gets external_event_id + * + * @return string + */ + public function getExternalEventId() + { + return $this->container['external_event_id']; + } + + /** + * Sets external_event_id + * + * @param string $external_event_id external_event_id + * + * @return self + */ + public function setExternalEventId($external_event_id) + { + if (is_null($external_event_id)) { + throw new \InvalidArgumentException('non-nullable external_event_id cannot be null'); + } + $this->container['external_event_id'] = $external_event_id; + + return $this; + } + + /** + * Gets app_id + * + * @return int + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param int $app_id app_id + * + * @return self + */ + public function setAppId($app_id) + { + if (is_null($app_id)) { + throw new \InvalidArgumentException('non-nullable app_id cannot be null'); + } + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets object_id + * + * @return string + */ + public function getObjectId() + { + return $this->container['object_id']; + } + + /** + * Sets object_id + * + * @param string $object_id object_id + * + * @return self + */ + public function setObjectId($object_id) + { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } + $this->container['object_id'] = $object_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Marketing/Events/Model/StandardError.php b/codegen/Marketing/Events/Model/StandardError.php index b29bda3e2..6e868c1ad 100644 --- a/codegen/Marketing/Events/Model/StandardError.php +++ b/codegen/Marketing/Events/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/SubscriberEmailResponse.php b/codegen/Marketing/Events/Model/SubscriberEmailResponse.php index 2b0fedcc2..e400e6fd8 100644 --- a/codegen/Marketing/Events/Model/SubscriberEmailResponse.php +++ b/codegen/Marketing/Events/Model/SubscriberEmailResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('vid', $data ?? [], null); $this->setIfExists('email', $data ?? [], null); diff --git a/codegen/Marketing/Events/Model/SubscriberVidResponse.php b/codegen/Marketing/Events/Model/SubscriberVidResponse.php index 5a8316bbe..9806f1d78 100644 --- a/codegen/Marketing/Events/Model/SubscriberVidResponse.php +++ b/codegen/Marketing/Events/Model/SubscriberVidResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('vid', $data ?? [], null); } diff --git a/codegen/Marketing/Events/ObjectSerializer.php b/codegen/Marketing/Events/ObjectSerializer.php index 7d342f4a3..d02bbea71 100644 --- a/codegen/Marketing/Events/ObjectSerializer.php +++ b/codegen/Marketing/Events/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Marketing/Forms/Api/FormsApi.php b/codegen/Marketing/Forms/Api/FormsApi.php index 5b61a8431..09cf1946a 100644 --- a/codegen/Marketing/Forms/Api/FormsApi.php +++ b/codegen/Marketing/Forms/Api/FormsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -98,13 +98,13 @@ class FormsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -192,18 +192,6 @@ public function archiveWithHttpInfo($form_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -434,18 +422,6 @@ public function createWithHttpInfo($form_definition_create_request_base, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -504,6 +480,19 @@ public function createWithHttpInfo($form_definition_create_request_base, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Forms\Model\FormDefinitionBase'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -729,7 +718,7 @@ public function createRequest($form_definition_create_request_base, string $cont * Get a form definition * * @param string $form_id The unique identifier of the form (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format @@ -748,7 +737,7 @@ public function getById($form_id, $archived = null, string $contentType = self:: * Get a form definition * * @param string $form_id The unique identifier of the form (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format @@ -781,18 +770,6 @@ public function getByIdWithHttpInfo($form_id, $archived = null, string $contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -851,6 +828,19 @@ public function getByIdWithHttpInfo($form_id, $archived = null, string $contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Forms\Model\FormDefinitionBase'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -908,7 +898,7 @@ public function getByIdWithHttpInfo($form_id, $archived = null, string $contentT * Get a form definition * * @param string $form_id The unique identifier of the form (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -930,7 +920,7 @@ function ($response) { * Get a form definition * * @param string $form_id The unique identifier of the form (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -981,7 +971,7 @@ function ($exception) { * Create request for operation 'getById' * * @param string $form_id The unique identifier of the form (required) - * @param bool $archived Whether to return only results that have been archived. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1089,10 +1079,10 @@ public function getByIdRequest($form_id, $archived = null, string $contentType = * * Get a list of forms * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) - * @param string[] $form_types The form types to be included in the results. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) + * @param string[]|null $form_types The form types to be included in the results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format @@ -1110,10 +1100,10 @@ public function getPage($after = null, $limit = null, $archived = null, $form_ty * * Get a list of forms * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) - * @param string[] $form_types The form types to be included in the results. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) + * @param string[]|null $form_types The form types to be included in the results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Marketing\Forms\ApiException on non-2xx response or if the response body is not in the expected format @@ -1146,18 +1136,6 @@ public function getPageWithHttpInfo($after = null, $limit = null, $archived = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1216,6 +1194,19 @@ public function getPageWithHttpInfo($after = null, $limit = null, $archived = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Forms\Model\CollectionResponseFormDefinitionBaseForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1272,10 +1263,10 @@ public function getPageWithHttpInfo($after = null, $limit = null, $archived = nu * * Get a list of forms * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) - * @param string[] $form_types The form types to be included in the results. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) + * @param string[]|null $form_types The form types to be included in the results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1296,10 +1287,10 @@ function ($response) { * * Get a list of forms * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) - * @param string[] $form_types The form types to be included in the results. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) + * @param string[]|null $form_types The form types to be included in the results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1349,10 +1340,10 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param int $limit The maximum number of results to display per page. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional) - * @param string[] $form_types The form types to be included in the results. (optional) + * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) + * @param int|null $limit The maximum number of results to display per page. (optional) + * @param bool|null $archived Whether to return only results that have been archived. (optional) + * @param string[]|null $form_types The form types to be included in the results. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1528,18 +1519,6 @@ public function replaceWithHttpInfo($form_id, $hub_spot_form_definition, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1598,6 +1577,19 @@ public function replaceWithHttpInfo($form_id, $hub_spot_form_definition, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Forms\Model\FormDefinitionBase'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1893,18 +1885,6 @@ public function updateWithHttpInfo($form_id, $hub_spot_form_definition_patch_req $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1963,6 +1943,19 @@ public function updateWithHttpInfo($form_id, $hub_spot_form_definition_patch_req ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Forms\Model\FormDefinitionBase'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Marketing/Forms/ApiException.php b/codegen/Marketing/Forms/ApiException.php index 33ecc0939..bb7f1d575 100644 --- a/codegen/Marketing/Forms/ApiException.php +++ b/codegen/Marketing/Forms/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Marketing/Forms/Configuration.php b/codegen/Marketing/Forms/Configuration.php index 641a759c4..3c8f03b42 100644 --- a/codegen/Marketing/Forms/Configuration.php +++ b/codegen/Marketing/Forms/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Marketing/Forms/HeaderSelector.php b/codegen/Marketing/Forms/HeaderSelector.php index e26605506..6f39ebaa4 100644 --- a/codegen/Marketing/Forms/HeaderSelector.php +++ b/codegen/Marketing/Forms/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPaging.php b/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPaging.php index 196add296..21d33b55e 100644 --- a/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPaging.php +++ b/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPagingResultsInner.php b/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPagingResultsInner.php index cfa76bf32..84abf9837 100644 --- a/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPagingResultsInner.php +++ b/codegen/Marketing/Forms/Model/CollectionResponseFormDefinitionBaseForwardPagingResultsInner.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -312,10 +312,10 @@ public function getFormTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('form_type', $data ?? [], 'hubspot'); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/DatepickerField.php b/codegen/Marketing/Forms/Model/DatepickerField.php index d44de0d55..6703faf4c 100644 --- a/codegen/Marketing/Forms/Model/DatepickerField.php +++ b/codegen/Marketing/Forms/Model/DatepickerField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,16 +58,16 @@ class DatepickerField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string' + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -78,16 +78,16 @@ class DatepickerField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null + 'field_type' => null, + 'required' => null ]; /** @@ -96,16 +96,16 @@ class DatepickerField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false + 'field_type' => false, + 'required' => false ]; /** @@ -194,16 +194,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue' + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -212,16 +212,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue' + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -230,16 +230,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue' + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -307,21 +307,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'datepicker'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'datepicker'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -351,6 +351,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -363,24 +378,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } return $invalidProperties; } @@ -397,119 +397,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label The main label for the form field. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -542,136 +532,146 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string $label The main label for the form field. * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets placeholder * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string|null */ - public function getDependentFields() + public function getPlaceholder() { - return $this->container['dependent_fields']; + return $this->container['placeholder']; } /** - * Sets dependent_fields + * Sets placeholder * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDependentFields($dependent_fields) + public function setPlaceholder($placeholder) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets placeholder + * Gets field_type * - * @return string|null + * @return string */ - public function getPlaceholder() + public function getFieldType() { - return $this->container['placeholder']; + return $this->container['field_type']; } /** - * Sets placeholder + * Sets field_type * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setPlaceholder($placeholder) + public function setFieldType($field_type) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['placeholder'] = $placeholder; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/DependentField.php b/codegen/Marketing/Forms/Model/DependentField.php index 465f470c1..01498844d 100644 --- a/codegen/Marketing/Forms/Model/DependentField.php +++ b/codegen/Marketing/Forms/Model/DependentField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('dependent_condition', $data ?? [], null); $this->setIfExists('dependent_field', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/DependentFieldDependentField.php b/codegen/Marketing/Forms/Model/DependentFieldDependentField.php index 9588de353..b9358c210 100644 --- a/codegen/Marketing/Forms/Model/DependentFieldDependentField.php +++ b/codegen/Marketing/Forms/Model/DependentFieldDependentField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,20 +57,20 @@ class DependentFieldDependentField implements ModelInterface, ArrayAccess, \Json * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string', + 'field_type' => 'string', + 'required' => 'bool', 'validation' => '\HubSpot\Client\Marketing\Forms\Model\NumberFieldValidation', 'use_country_code_select' => 'bool', - 'default_values' => 'string[]', 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]', + 'default_values' => 'string[]', 'allow_multiple_files' => 'bool' ]; @@ -82,20 +82,20 @@ class DependentFieldDependentField implements ModelInterface, ArrayAccess, \Json * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null, + 'field_type' => null, + 'required' => null, 'validation' => null, 'use_country_code_select' => null, - 'default_values' => null, 'options' => null, + 'default_values' => null, 'allow_multiple_files' => null ]; @@ -105,20 +105,20 @@ class DependentFieldDependentField implements ModelInterface, ArrayAccess, \Json * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false, + 'field_type' => false, + 'required' => false, 'validation' => false, 'use_country_code_select' => false, - 'default_values' => false, 'options' => false, + 'default_values' => false, 'allow_multiple_files' => false ]; @@ -208,20 +208,20 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue', + 'field_type' => 'fieldType', + 'required' => 'required', 'validation' => 'validation', 'use_country_code_select' => 'useCountryCodeSelect', - 'default_values' => 'defaultValues', 'options' => 'options', + 'default_values' => 'defaultValues', 'allow_multiple_files' => 'allowMultipleFiles' ]; @@ -231,20 +231,20 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue', + 'field_type' => 'setFieldType', + 'required' => 'setRequired', 'validation' => 'setValidation', 'use_country_code_select' => 'setUseCountryCodeSelect', - 'default_values' => 'setDefaultValues', 'options' => 'setOptions', + 'default_values' => 'setDefaultValues', 'allow_multiple_files' => 'setAllowMultipleFiles' ]; @@ -254,20 +254,20 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue', + 'field_type' => 'getFieldType', + 'required' => 'getRequired', 'validation' => 'getValidation', 'use_country_code_select' => 'getUseCountryCodeSelect', - 'default_values' => 'getDefaultValues', 'options' => 'getOptions', + 'default_values' => 'getDefaultValues', 'allow_multiple_files' => 'getAllowMultipleFiles' ]; @@ -336,25 +336,25 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'payment_link_radio'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'payment_link_radio'); + $this->setIfExists('required', $data ?? [], null); $this->setIfExists('validation', $data ?? [], null); $this->setIfExists('use_country_code_select', $data ?? [], null); - $this->setIfExists('default_values', $data ?? [], null); $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('default_values', $data ?? [], null); $this->setIfExists('allow_multiple_files', $data ?? [], null); } @@ -385,6 +385,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -397,36 +412,21 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } if ($this->container['validation'] === null) { $invalidProperties[] = "'validation' can't be null"; } if ($this->container['use_country_code_select'] === null) { $invalidProperties[] = "'use_country_code_select' can't be null"; } - if ($this->container['default_values'] === null) { - $invalidProperties[] = "'default_values' can't be null"; - } if ($this->container['options'] === null) { $invalidProperties[] = "'options' can't be null"; } + if ($this->container['default_values'] === null) { + $invalidProperties[] = "'default_values' can't be null"; + } if ($this->container['allow_multiple_files'] === null) { $invalidProperties[] = "'allow_multiple_files' can't be null"; } @@ -446,119 +446,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type field_type + * @param string $object_type_id object_type_id * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id object_type_id + * @param bool $hidden hidden * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name name + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label label + * @param string $name name * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -591,136 +581,146 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required required + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields dependent_fields * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden hidden + * @param string $label label * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets placeholder * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string|null */ - public function getDependentFields() + public function getPlaceholder() { - return $this->container['dependent_fields']; + return $this->container['placeholder']; } /** - * Sets dependent_fields + * Sets placeholder * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields dependent_fields + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDependentFields($dependent_fields) + public function setPlaceholder($placeholder) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets placeholder + * Gets field_type * - * @return string|null + * @return string */ - public function getPlaceholder() + public function getFieldType() { - return $this->container['placeholder']; + return $this->container['field_type']; } /** - * Sets placeholder + * Sets field_type * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param string $field_type field_type * * @return self */ - public function setPlaceholder($placeholder) + public function setFieldType($field_type) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['placeholder'] = $placeholder; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required required * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } @@ -780,55 +780,55 @@ public function setUseCountryCodeSelect($use_country_code_select) } /** - * Gets default_values + * Gets options * - * @return string[] + * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] */ - public function getDefaultValues() + public function getOptions() { - return $this->container['default_values']; + return $this->container['options']; } /** - * Sets default_values + * Sets options * - * @param string[] $default_values default_values + * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options options * * @return self */ - public function setDefaultValues($default_values) + public function setOptions($options) { - if (is_null($default_values)) { - throw new \InvalidArgumentException('non-nullable default_values cannot be null'); + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); } - $this->container['default_values'] = $default_values; + $this->container['options'] = $options; return $this; } /** - * Gets options + * Gets default_values * - * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] + * @return string[] */ - public function getOptions() + public function getDefaultValues() { - return $this->container['options']; + return $this->container['default_values']; } /** - * Sets options + * Sets default_values * - * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options options + * @param string[] $default_values default_values * * @return self */ - public function setOptions($options) + public function setDefaultValues($default_values) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($default_values)) { + throw new \InvalidArgumentException('non-nullable default_values cannot be null'); } - $this->container['options'] = $options; + $this->container['default_values'] = $default_values; return $this; } diff --git a/codegen/Marketing/Forms/Model/DependentFieldFilter.php b/codegen/Marketing/Forms/Model/DependentFieldFilter.php index 674835a71..5c7bf4961 100644 --- a/codegen/Marketing/Forms/Model/DependentFieldFilter.php +++ b/codegen/Marketing/Forms/Model/DependentFieldFilter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,10 +58,10 @@ class DependentFieldFilter implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ - 'operator' => 'string', - 'value' => 'string', - 'values' => 'string[]', 'range_start' => 'string', + 'values' => 'string[]', + 'value' => 'string', + 'operator' => 'string', 'range_end' => 'string' ]; @@ -73,10 +73,10 @@ class DependentFieldFilter implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ - 'operator' => null, - 'value' => null, - 'values' => null, 'range_start' => null, + 'values' => null, + 'value' => null, + 'operator' => null, 'range_end' => null ]; @@ -86,10 +86,10 @@ class DependentFieldFilter implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'operator' => false, - 'value' => false, - 'values' => false, 'range_start' => false, + 'values' => false, + 'value' => false, + 'operator' => false, 'range_end' => false ]; @@ -179,10 +179,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'operator' => 'operator', - 'value' => 'value', - 'values' => 'values', 'range_start' => 'rangeStart', + 'values' => 'values', + 'value' => 'value', + 'operator' => 'operator', 'range_end' => 'rangeEnd' ]; @@ -192,10 +192,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'operator' => 'setOperator', - 'value' => 'setValue', - 'values' => 'setValues', 'range_start' => 'setRangeStart', + 'values' => 'setValues', + 'value' => 'setValue', + 'operator' => 'setOperator', 'range_end' => 'setRangeEnd' ]; @@ -205,10 +205,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'operator' => 'getOperator', - 'value' => 'getValue', - 'values' => 'getValues', 'range_start' => 'getRangeStart', + 'values' => 'getValues', + 'value' => 'getValue', + 'operator' => 'getOperator', 'range_end' => 'getRangeEnd' ]; @@ -317,15 +317,15 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('operator', $data ?? [], null); - $this->setIfExists('value', $data ?? [], null); - $this->setIfExists('values', $data ?? [], null); $this->setIfExists('range_start', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); $this->setIfExists('range_end', $data ?? [], null); } @@ -356,6 +356,15 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['range_start'] === null) { + $invalidProperties[] = "'range_start' can't be null"; + } + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } if ($this->container['operator'] === null) { $invalidProperties[] = "'operator' can't be null"; } @@ -368,15 +377,6 @@ public function listInvalidProperties() ); } - if ($this->container['value'] === null) { - $invalidProperties[] = "'value' can't be null"; - } - if ($this->container['values'] === null) { - $invalidProperties[] = "'values' can't be null"; - } - if ($this->container['range_start'] === null) { - $invalidProperties[] = "'range_start' can't be null"; - } if ($this->container['range_end'] === null) { $invalidProperties[] = "'range_end' can't be null"; } @@ -396,119 +396,119 @@ public function valid() /** - * Gets operator + * Gets range_start * * @return string */ - public function getOperator() + public function getRangeStart() { - return $this->container['operator']; + return $this->container['range_start']; } /** - * Sets operator + * Sets range_start * - * @param string $operator operator + * @param string $range_start * * @return self */ - public function setOperator($operator) + public function setRangeStart($range_start) { - if (is_null($operator)) { - throw new \InvalidArgumentException('non-nullable operator cannot be null'); - } - $allowedValues = $this->getOperatorAllowableValues(); - if (!in_array($operator, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'operator', must be one of '%s'", - $operator, - implode("', '", $allowedValues) - ) - ); + if (is_null($range_start)) { + throw new \InvalidArgumentException('non-nullable range_start cannot be null'); } - $this->container['operator'] = $operator; + $this->container['range_start'] = $range_start; return $this; } /** - * Gets value + * Gets values * - * @return string + * @return string[] */ - public function getValue() + public function getValues() { - return $this->container['value']; + return $this->container['values']; } /** - * Sets value + * Sets values * - * @param string $value value + * @param string[] $values * * @return self */ - public function setValue($value) + public function setValues($values) { - if (is_null($value)) { - throw new \InvalidArgumentException('non-nullable value cannot be null'); + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); } - $this->container['value'] = $value; + $this->container['values'] = $values; return $this; } /** - * Gets values + * Gets value * - * @return string[] + * @return string */ - public function getValues() + public function getValue() { - return $this->container['values']; + return $this->container['value']; } /** - * Sets values + * Sets value * - * @param string[] $values values + * @param string $value * * @return self */ - public function setValues($values) + public function setValue($value) { - if (is_null($values)) { - throw new \InvalidArgumentException('non-nullable values cannot be null'); + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); } - $this->container['values'] = $values; + $this->container['value'] = $value; return $this; } /** - * Gets range_start + * Gets operator * * @return string */ - public function getRangeStart() + public function getOperator() { - return $this->container['range_start']; + return $this->container['operator']; } /** - * Sets range_start + * Sets operator * - * @param string $range_start range_start + * @param string $operator * * @return self */ - public function setRangeStart($range_start) + public function setOperator($operator) { - if (is_null($range_start)) { - throw new \InvalidArgumentException('non-nullable range_start cannot be null'); + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); } - $this->container['range_start'] = $range_start; + $allowedValues = $this->getOperatorAllowableValues(); + if (!in_array($operator, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operator', must be one of '%s'", + $operator, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operator'] = $operator; return $this; } @@ -526,7 +526,7 @@ public function getRangeEnd() /** * Sets range_end * - * @param string $range_end range_end + * @param string $range_end * * @return self */ diff --git a/codegen/Marketing/Forms/Model/DropdownField.php b/codegen/Marketing/Forms/Model/DropdownField.php index fe5662c3a..fe9dfd5fd 100644 --- a/codegen/Marketing/Forms/Model/DropdownField.php +++ b/codegen/Marketing/Forms/Model/DropdownField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,17 +58,17 @@ class DropdownField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', 'name' => 'string', - 'label' => 'string', + 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', - 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', 'default_values' => 'string[]', - 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]', - 'placeholder' => 'string' + 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', + 'placeholder' => 'string', + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -79,17 +79,17 @@ class DropdownField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, 'name' => null, - 'label' => null, + 'options' => null, 'description' => null, - 'required' => null, - 'hidden' => null, - 'dependent_fields' => null, 'default_values' => null, - 'options' => null, - 'placeholder' => null + 'dependent_fields' => null, + 'label' => null, + 'placeholder' => null, + 'field_type' => null, + 'required' => null ]; /** @@ -98,17 +98,17 @@ class DropdownField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, 'name' => false, - 'label' => false, + 'options' => false, 'description' => false, - 'required' => false, - 'hidden' => false, - 'dependent_fields' => false, 'default_values' => false, - 'options' => false, - 'placeholder' => false + 'dependent_fields' => false, + 'label' => false, + 'placeholder' => false, + 'field_type' => false, + 'required' => false ]; /** @@ -197,17 +197,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', 'name' => 'name', - 'label' => 'label', + 'options' => 'options', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', - 'dependent_fields' => 'dependentFields', 'default_values' => 'defaultValues', - 'options' => 'options', - 'placeholder' => 'placeholder' + 'dependent_fields' => 'dependentFields', + 'label' => 'label', + 'placeholder' => 'placeholder', + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -216,17 +216,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', 'name' => 'setName', - 'label' => 'setLabel', + 'options' => 'setOptions', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', - 'dependent_fields' => 'setDependentFields', 'default_values' => 'setDefaultValues', - 'options' => 'setOptions', - 'placeholder' => 'setPlaceholder' + 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', + 'placeholder' => 'setPlaceholder', + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -235,17 +235,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', 'name' => 'getName', - 'label' => 'getLabel', + 'options' => 'getOptions', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', - 'dependent_fields' => 'getDependentFields', 'default_values' => 'getDefaultValues', - 'options' => 'getOptions', - 'placeholder' => 'getPlaceholder' + 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', + 'placeholder' => 'getPlaceholder', + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -313,22 +313,22 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'dropdown'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('dependent_fields', $data ?? [], null); $this->setIfExists('default_values', $data ?? [], null); - $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'dropdown'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -358,6 +358,27 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['options'] === null) { + $invalidProperties[] = "'options' can't be null"; + } + if ($this->container['default_values'] === null) { + $invalidProperties[] = "'default_values' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -370,30 +391,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } - if ($this->container['default_values'] === null) { - $invalidProperties[] = "'default_values' can't be null"; - } - if ($this->container['options'] === null) { - $invalidProperties[] = "'options' can't be null"; - } return $invalidProperties; } @@ -410,65 +410,55 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } @@ -501,28 +491,28 @@ public function setName($name) } /** - * Gets label + * Gets options * - * @return string + * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] */ - public function getLabel() + public function getOptions() { - return $this->container['label']; + return $this->container['options']; } /** - * Sets label + * Sets options * - * @param string $label The main label for the form field. + * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options The list of available choices for this field. * * @return self */ - public function setLabel($label) + public function setOptions($options) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); } - $this->container['label'] = $label; + $this->container['options'] = $options; return $this; } @@ -555,163 +545,173 @@ public function setDescription($description) } /** - * Gets required + * Gets default_values * - * @return bool + * @return string[] */ - public function getRequired() + public function getDefaultValues() { - return $this->container['required']; + return $this->container['default_values']; } /** - * Sets required + * Sets default_values * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param string[] $default_values The values selected by default. Those values will be submitted unless the customer modifies them. * * @return self */ - public function setRequired($required) + public function setDefaultValues($default_values) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($default_values)) { + throw new \InvalidArgumentException('non-nullable default_values cannot be null'); } - $this->container['required'] = $required; + $this->container['default_values'] = $default_values; return $this; } /** - * Gets hidden + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getHidden() + public function getDependentFields() { - return $this->container['hidden']; + return $this->container['dependent_fields']; } /** - * Sets hidden + * Sets dependent_fields * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setHidden($hidden) + public function setDependentFields($dependent_fields) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets dependent_fields + * Gets label * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string */ - public function getDependentFields() + public function getLabel() { - return $this->container['dependent_fields']; + return $this->container['label']; } /** - * Sets dependent_fields + * Sets label * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string $label The main label for the form field. * * @return self */ - public function setDependentFields($dependent_fields) + public function setLabel($label) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['label'] = $label; return $this; } /** - * Gets default_values + * Gets placeholder * - * @return string[] + * @return string|null */ - public function getDefaultValues() + public function getPlaceholder() { - return $this->container['default_values']; + return $this->container['placeholder']; } /** - * Sets default_values + * Sets placeholder * - * @param string[] $default_values The values selected by default. Those values will be submitted unless the customer modifies them. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDefaultValues($default_values) + public function setPlaceholder($placeholder) { - if (is_null($default_values)) { - throw new \InvalidArgumentException('non-nullable default_values cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['default_values'] = $default_values; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets options + * Gets field_type * - * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] + * @return string */ - public function getOptions() + public function getFieldType() { - return $this->container['options']; + return $this->container['field_type']; } /** - * Sets options + * Sets field_type * - * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options The list of available choices for this field. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setOptions($options) + public function setFieldType($field_type) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['options'] = $options; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets placeholder + * Gets required * - * @return string|null + * @return bool */ - public function getPlaceholder() + public function getRequired() { - return $this->container['placeholder']; + return $this->container['required']; } /** - * Sets placeholder + * Sets required * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setPlaceholder($placeholder) + public function setRequired($required) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['placeholder'] = $placeholder; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/EmailField.php b/codegen/Marketing/Forms/Model/EmailField.php index 545bfd2be..357d062ab 100644 --- a/codegen/Marketing/Forms/Model/EmailField.php +++ b/codegen/Marketing/Forms/Model/EmailField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,16 +58,16 @@ class EmailField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string', + 'field_type' => 'string', + 'required' => 'bool', 'validation' => '\HubSpot\Client\Marketing\Forms\Model\EmailFieldValidation' ]; @@ -79,16 +79,16 @@ class EmailField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null, + 'field_type' => null, + 'required' => null, 'validation' => null ]; @@ -98,16 +98,16 @@ class EmailField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false, + 'field_type' => false, + 'required' => false, 'validation' => false ]; @@ -197,16 +197,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue', + 'field_type' => 'fieldType', + 'required' => 'required', 'validation' => 'validation' ]; @@ -216,16 +216,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue', + 'field_type' => 'setFieldType', + 'required' => 'setRequired', 'validation' => 'setValidation' ]; @@ -235,16 +235,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue', + 'field_type' => 'getFieldType', + 'required' => 'getRequired', 'validation' => 'getValidation' ]; @@ -313,21 +313,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'email'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'email'); + $this->setIfExists('required', $data ?? [], null); $this->setIfExists('validation', $data ?? [], null); } @@ -358,6 +358,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -370,24 +385,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } if ($this->container['validation'] === null) { $invalidProperties[] = "'validation' can't be null"; } @@ -407,119 +407,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label The main label for the form field. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -552,136 +542,146 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string $label The main label for the form field. * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets placeholder * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string|null */ - public function getDependentFields() + public function getPlaceholder() { - return $this->container['dependent_fields']; + return $this->container['placeholder']; } /** - * Sets dependent_fields + * Sets placeholder * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDependentFields($dependent_fields) + public function setPlaceholder($placeholder) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets placeholder + * Gets field_type * - * @return string|null + * @return string */ - public function getPlaceholder() + public function getFieldType() { - return $this->container['placeholder']; + return $this->container['field_type']; } /** - * Sets placeholder + * Sets field_type * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setPlaceholder($placeholder) + public function setFieldType($field_type) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['placeholder'] = $placeholder; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/EmailFieldValidation.php b/codegen/Marketing/Forms/Model/EmailFieldValidation.php index c904f2eca..17382776b 100644 --- a/codegen/Marketing/Forms/Model/EmailFieldValidation.php +++ b/codegen/Marketing/Forms/Model/EmailFieldValidation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ class EmailFieldValidation implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ - 'blocked_email_domains' => 'string[]', - 'use_default_block_list' => 'bool' + 'use_default_block_list' => 'bool', + 'blocked_email_domains' => 'string[]' ]; /** @@ -70,8 +70,8 @@ class EmailFieldValidation implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ - 'blocked_email_domains' => null, - 'use_default_block_list' => null + 'use_default_block_list' => null, + 'blocked_email_domains' => null ]; /** @@ -80,8 +80,8 @@ class EmailFieldValidation implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'blocked_email_domains' => false, - 'use_default_block_list' => false + 'use_default_block_list' => false, + 'blocked_email_domains' => false ]; /** @@ -170,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'blocked_email_domains' => 'blockedEmailDomains', - 'use_default_block_list' => 'useDefaultBlockList' + 'use_default_block_list' => 'useDefaultBlockList', + 'blocked_email_domains' => 'blockedEmailDomains' ]; /** @@ -180,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'blocked_email_domains' => 'setBlockedEmailDomains', - 'use_default_block_list' => 'setUseDefaultBlockList' + 'use_default_block_list' => 'setUseDefaultBlockList', + 'blocked_email_domains' => 'setBlockedEmailDomains' ]; /** @@ -190,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'blocked_email_domains' => 'getBlockedEmailDomains', - 'use_default_block_list' => 'getUseDefaultBlockList' + 'use_default_block_list' => 'getUseDefaultBlockList', + 'blocked_email_domains' => 'getBlockedEmailDomains' ]; /** @@ -246,13 +246,13 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('blocked_email_domains', $data ?? [], null); $this->setIfExists('use_default_block_list', $data ?? [], null); + $this->setIfExists('blocked_email_domains', $data ?? [], null); } /** @@ -282,12 +282,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['blocked_email_domains'] === null) { - $invalidProperties[] = "'blocked_email_domains' can't be null"; - } if ($this->container['use_default_block_list'] === null) { $invalidProperties[] = "'use_default_block_list' can't be null"; } + if ($this->container['blocked_email_domains'] === null) { + $invalidProperties[] = "'blocked_email_domains' can't be null"; + } return $invalidProperties; } @@ -304,55 +304,55 @@ public function valid() /** - * Gets blocked_email_domains + * Gets use_default_block_list * - * @return string[] + * @return bool */ - public function getBlockedEmailDomains() + public function getUseDefaultBlockList() { - return $this->container['blocked_email_domains']; + return $this->container['use_default_block_list']; } /** - * Sets blocked_email_domains + * Sets use_default_block_list * - * @param string[] $blocked_email_domains A list of email domains to block. + * @param bool $use_default_block_list Whether to block the free email providers. * * @return self */ - public function setBlockedEmailDomains($blocked_email_domains) + public function setUseDefaultBlockList($use_default_block_list) { - if (is_null($blocked_email_domains)) { - throw new \InvalidArgumentException('non-nullable blocked_email_domains cannot be null'); + if (is_null($use_default_block_list)) { + throw new \InvalidArgumentException('non-nullable use_default_block_list cannot be null'); } - $this->container['blocked_email_domains'] = $blocked_email_domains; + $this->container['use_default_block_list'] = $use_default_block_list; return $this; } /** - * Gets use_default_block_list + * Gets blocked_email_domains * - * @return bool + * @return string[] */ - public function getUseDefaultBlockList() + public function getBlockedEmailDomains() { - return $this->container['use_default_block_list']; + return $this->container['blocked_email_domains']; } /** - * Sets use_default_block_list + * Sets blocked_email_domains * - * @param bool $use_default_block_list Whether to block the free email providers. + * @param string[] $blocked_email_domains A list of email domains to block. * * @return self */ - public function setUseDefaultBlockList($use_default_block_list) + public function setBlockedEmailDomains($blocked_email_domains) { - if (is_null($use_default_block_list)) { - throw new \InvalidArgumentException('non-nullable use_default_block_list cannot be null'); + if (is_null($blocked_email_domains)) { + throw new \InvalidArgumentException('non-nullable blocked_email_domains cannot be null'); } - $this->container['use_default_block_list'] = $use_default_block_list; + $this->container['blocked_email_domains'] = $blocked_email_domains; return $this; } diff --git a/codegen/Marketing/Forms/Model/EnumeratedFieldOption.php b/codegen/Marketing/Forms/Model/EnumeratedFieldOption.php index 24919962f..50767c938 100644 --- a/codegen/Marketing/Forms/Model/EnumeratedFieldOption.php +++ b/codegen/Marketing/Forms/Model/EnumeratedFieldOption.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,10 +57,10 @@ class EnumeratedFieldOption implements ModelInterface, ArrayAccess, \JsonSeriali * @var string[] */ protected static $openAPITypes = [ - 'label' => 'string', - 'value' => 'string', + 'display_order' => 'int', 'description' => 'string', - 'display_order' => 'int' + 'label' => 'string', + 'value' => 'string' ]; /** @@ -71,10 +71,10 @@ class EnumeratedFieldOption implements ModelInterface, ArrayAccess, \JsonSeriali * @psalm-var array */ protected static $openAPIFormats = [ - 'label' => null, - 'value' => null, + 'display_order' => 'int32', 'description' => null, - 'display_order' => 'int32' + 'label' => null, + 'value' => null ]; /** @@ -83,10 +83,10 @@ class EnumeratedFieldOption implements ModelInterface, ArrayAccess, \JsonSeriali * @var boolean[] */ protected static array $openAPINullables = [ - 'label' => false, - 'value' => false, + 'display_order' => false, 'description' => false, - 'display_order' => false + 'label' => false, + 'value' => false ]; /** @@ -175,10 +175,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'label' => 'label', - 'value' => 'value', + 'display_order' => 'displayOrder', 'description' => 'description', - 'display_order' => 'displayOrder' + 'label' => 'label', + 'value' => 'value' ]; /** @@ -187,10 +187,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'label' => 'setLabel', - 'value' => 'setValue', + 'display_order' => 'setDisplayOrder', 'description' => 'setDescription', - 'display_order' => 'setDisplayOrder' + 'label' => 'setLabel', + 'value' => 'setValue' ]; /** @@ -199,10 +199,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'label' => 'getLabel', - 'value' => 'getValue', + 'display_order' => 'getDisplayOrder', 'description' => 'getDescription', - 'display_order' => 'getDisplayOrder' + 'label' => 'getLabel', + 'value' => 'getValue' ]; /** @@ -257,15 +257,15 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { + $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); - $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('display_order', $data ?? [], null); } /** @@ -295,15 +295,15 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['display_order'] === null) { + $invalidProperties[] = "'display_order' can't be null"; + } if ($this->container['label'] === null) { $invalidProperties[] = "'label' can't be null"; } if ($this->container['value'] === null) { $invalidProperties[] = "'value' can't be null"; } - if ($this->container['display_order'] === null) { - $invalidProperties[] = "'display_order' can't be null"; - } return $invalidProperties; } @@ -320,109 +320,109 @@ public function valid() /** - * Gets label + * Gets display_order * - * @return string + * @return int */ - public function getLabel() + public function getDisplayOrder() { - return $this->container['label']; + return $this->container['display_order']; } /** - * Sets label + * Sets display_order * - * @param string $label The visible label for this choice. + * @param int $display_order The order the choices will be displayed in. * * @return self */ - public function setLabel($label) + public function setDisplayOrder($display_order) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($display_order)) { + throw new \InvalidArgumentException('non-nullable display_order cannot be null'); } - $this->container['label'] = $label; + $this->container['display_order'] = $display_order; return $this; } /** - * Gets value + * Gets description * - * @return string + * @return string|null */ - public function getValue() + public function getDescription() { - return $this->container['value']; + return $this->container['description']; } /** - * Sets value + * Sets description * - * @param string $value The value which will be submitted if this choice is selected. + * @param string|null $description * * @return self */ - public function setValue($value) + public function setDescription($description) { - if (is_null($value)) { - throw new \InvalidArgumentException('non-nullable value cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['value'] = $value; + $this->container['description'] = $description; return $this; } /** - * Gets description + * Gets label * - * @return string|null + * @return string */ - public function getDescription() + public function getLabel() { - return $this->container['description']; + return $this->container['label']; } /** - * Sets description + * Sets label * - * @param string|null $description description + * @param string $label The visible label for this choice. * * @return self */ - public function setDescription($description) + public function setLabel($label) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['description'] = $description; + $this->container['label'] = $label; return $this; } /** - * Gets display_order + * Gets value * - * @return int + * @return string */ - public function getDisplayOrder() + public function getValue() { - return $this->container['display_order']; + return $this->container['value']; } /** - * Sets display_order + * Sets value * - * @param int $display_order The order the choices will be displayed in. + * @param string $value The value which will be submitted if this choice is selected. * * @return self */ - public function setDisplayOrder($display_order) + public function setValue($value) { - if (is_null($display_order)) { - throw new \InvalidArgumentException('non-nullable display_order cannot be null'); + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); } - $this->container['display_order'] = $display_order; + $this->container['value'] = $value; return $this; } diff --git a/codegen/Marketing/Forms/Model/Error.php b/codegen/Marketing/Forms/Model/Error.php index 8706ba018..95c8e7657 100644 --- a/codegen/Marketing/Forms/Model/Error.php +++ b/codegen/Marketing/Forms/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/ErrorDetail.php b/codegen/Marketing/Forms/Model/ErrorDetail.php index 71c238df8..597df8e65 100644 --- a/codegen/Marketing/Forms/Model/ErrorDetail.php +++ b/codegen/Marketing/Forms/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/FieldGroup.php b/codegen/Marketing/Forms/Model/FieldGroup.php index 0f58c573a..6345429ab 100644 --- a/codegen/Marketing/Forms/Model/FieldGroup.php +++ b/codegen/Marketing/Forms/Model/FieldGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -290,10 +290,10 @@ public function getRichTextTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('group_type', $data ?? [], null); $this->setIfExists('rich_text_type', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/FileField.php b/codegen/Marketing/Forms/Model/FileField.php index ad30f17c0..2dd55b42a 100644 --- a/codegen/Marketing/Forms/Model/FileField.php +++ b/codegen/Marketing/Forms/Model/FileField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,17 +58,17 @@ class FileField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'allow_multiple_files' => 'bool', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string', - 'allow_multiple_files' => 'bool' + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -79,17 +79,17 @@ class FileField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'allow_multiple_files' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null, - 'allow_multiple_files' => null + 'field_type' => null, + 'required' => null ]; /** @@ -98,17 +98,17 @@ class FileField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'allow_multiple_files' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false, - 'allow_multiple_files' => false + 'field_type' => false, + 'required' => false ]; /** @@ -197,17 +197,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'allow_multiple_files' => 'allowMultipleFiles', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue', - 'allow_multiple_files' => 'allowMultipleFiles' + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -216,17 +216,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'allow_multiple_files' => 'setAllowMultipleFiles', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue', - 'allow_multiple_files' => 'setAllowMultipleFiles' + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -235,17 +235,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'allow_multiple_files' => 'getAllowMultipleFiles', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue', - 'allow_multiple_files' => 'getAllowMultipleFiles' + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -313,22 +313,22 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'file'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('allow_multiple_files', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); - $this->setIfExists('allow_multiple_files', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'file'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -358,6 +358,24 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['allow_multiple_files'] === null) { + $invalidProperties[] = "'allow_multiple_files' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -370,27 +388,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } - if ($this->container['allow_multiple_files'] === null) { - $invalidProperties[] = "'allow_multiple_files' can't be null"; - } return $invalidProperties; } @@ -406,43 +406,6 @@ public function valid() } - /** - * Gets field_type - * - * @return string - */ - public function getFieldType() - { - return $this->container['field_type']; - } - - /** - * Sets field_type - * - * @param string $field_type Determines how the field will be displayed and validated. - * - * @return self - */ - public function setFieldType($field_type) - { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['field_type'] = $field_type; - - return $this; - } - /** * Gets object_type_id * @@ -471,136 +434,136 @@ public function setObjectTypeId($object_type_id) } /** - * Gets name + * Gets allow_multiple_files * - * @return string + * @return bool */ - public function getName() + public function getAllowMultipleFiles() { - return $this->container['name']; + return $this->container['allow_multiple_files']; } /** - * Sets name + * Sets allow_multiple_files * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param bool $allow_multiple_files Whether to allow the upload of multiple files. * * @return self */ - public function setName($name) + public function setAllowMultipleFiles($allow_multiple_files) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($allow_multiple_files)) { + throw new \InvalidArgumentException('non-nullable allow_multiple_files cannot be null'); } - $this->container['name'] = $name; + $this->container['allow_multiple_files'] = $allow_multiple_files; return $this; } /** - * Gets label + * Gets hidden * - * @return string + * @return bool */ - public function getLabel() + public function getHidden() { - return $this->container['label']; + return $this->container['hidden']; } /** - * Sets label + * Sets hidden * - * @param string $label The main label for the form field. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setLabel($label) + public function setHidden($hidden) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['label'] = $label; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets description + * Gets default_value * * @return string|null */ - public function getDescription() + public function getDefaultValue() { - return $this->container['description']; + return $this->container['default_value']; } /** - * Sets description + * Sets default_value * - * @param string|null $description Additional text helping the customer to complete the field. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setDescription($description) + public function setDefaultValue($default_value) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['description'] = $description; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets required + * Gets name * - * @return bool + * @return string */ - public function getRequired() + public function getName() { - return $this->container['required']; + return $this->container['name']; } /** - * Sets required + * Sets name * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setRequired($required) + public function setName($name) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['required'] = $required; + $this->container['name'] = $name; return $this; } /** - * Gets hidden + * Gets description * - * @return bool + * @return string|null */ - public function getHidden() + public function getDescription() { - return $this->container['hidden']; + return $this->container['description']; } /** - * Sets hidden + * Sets description * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string|null $description Additional text helping the customer to complete the field. * * @return self */ - public function setHidden($hidden) + public function setDescription($description) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['description'] = $description; return $this; } @@ -632,6 +595,33 @@ public function setDependentFields($dependent_fields) return $this; } + /** + * Gets label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label The main label for the form field. + * + * @return self + */ + public function setLabel($label) + { + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); + } + $this->container['label'] = $label; + + return $this; + } + /** * Gets placeholder * @@ -660,55 +650,65 @@ public function setPlaceholder($placeholder) } /** - * Gets default_value + * Gets field_type * - * @return string|null + * @return string */ - public function getDefaultValue() + public function getFieldType() { - return $this->container['default_value']; + return $this->container['field_type']; } /** - * Sets default_value + * Sets field_type * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setDefaultValue($default_value) + public function setFieldType($field_type) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['default_value'] = $default_value; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets allow_multiple_files + * Gets required * * @return bool */ - public function getAllowMultipleFiles() + public function getRequired() { - return $this->container['allow_multiple_files']; + return $this->container['required']; } /** - * Sets allow_multiple_files + * Sets required * - * @param bool $allow_multiple_files Whether to allow the upload of multiple files. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setAllowMultipleFiles($allow_multiple_files) + public function setRequired($required) { - if (is_null($allow_multiple_files)) { - throw new \InvalidArgumentException('non-nullable allow_multiple_files cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['allow_multiple_files'] = $allow_multiple_files; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/FormDefinitionBase.php b/codegen/Marketing/Forms/Model/FormDefinitionBase.php index 3082b7cfc..d2dc9c255 100644 --- a/codegen/Marketing/Forms/Model/FormDefinitionBase.php +++ b/codegen/Marketing/Forms/Model/FormDefinitionBase.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -312,10 +312,10 @@ public function getFormTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('form_type', $data ?? [], 'hubspot'); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/FormDefinitionCreateRequestBase.php b/codegen/Marketing/Forms/Model/FormDefinitionCreateRequestBase.php index c24ea96bf..8f2da0ebc 100644 --- a/codegen/Marketing/Forms/Model/FormDefinitionCreateRequestBase.php +++ b/codegen/Marketing/Forms/Model/FormDefinitionCreateRequestBase.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -306,10 +306,10 @@ public function getFormTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('form_type', $data ?? [], 'hubspot'); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/FormDisplayOptions.php b/codegen/Marketing/Forms/Model/FormDisplayOptions.php index eaf6603f0..ae7620d76 100644 --- a/codegen/Marketing/Forms/Model/FormDisplayOptions.php +++ b/codegen/Marketing/Forms/Model/FormDisplayOptions.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getThemeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('render_raw_html', $data ?? [], null); $this->setIfExists('css_class', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/FormPostSubmitAction.php b/codegen/Marketing/Forms/Model/FormPostSubmitAction.php index 4e74f4760..947ca06eb 100644 --- a/codegen/Marketing/Forms/Model/FormPostSubmitAction.php +++ b/codegen/Marketing/Forms/Model/FormPostSubmitAction.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -261,10 +261,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/FormStyle.php b/codegen/Marketing/Forms/Model/FormStyle.php index bc2c6c510..2541f268a 100644 --- a/codegen/Marketing/Forms/Model/FormStyle.php +++ b/codegen/Marketing/Forms/Model/FormStyle.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -323,10 +323,10 @@ public function getSubmitAlignmentAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('label_text_size', $data ?? [], null); $this->setIfExists('legal_consent_text_color', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/ForwardPaging.php b/codegen/Marketing/Forms/Model/ForwardPaging.php index 5e2f8dde2..925f3d790 100644 --- a/codegen/Marketing/Forms/Model/ForwardPaging.php +++ b/codegen/Marketing/Forms/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Marketing/Forms/Model/HubSpotFormConfiguration.php b/codegen/Marketing/Forms/Model/HubSpotFormConfiguration.php index 05bc8de55..d84b66196 100644 --- a/codegen/Marketing/Forms/Model/HubSpotFormConfiguration.php +++ b/codegen/Marketing/Forms/Model/HubSpotFormConfiguration.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -400,10 +400,10 @@ public function getLanguageAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('create_new_contact_for_new_email', $data ?? [], null); $this->setIfExists('editable', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/HubSpotFormDefinition.php b/codegen/Marketing/Forms/Model/HubSpotFormDefinition.php index 6f5f92d41..5eed34954 100644 --- a/codegen/Marketing/Forms/Model/HubSpotFormDefinition.php +++ b/codegen/Marketing/Forms/Model/HubSpotFormDefinition.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -312,10 +312,10 @@ public function getFormTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('form_type', $data ?? [], 'hubspot'); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php index 2b12296c4..d1f930b9f 100644 --- a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php +++ b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionAllOfLegalConsentOptions.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -61,11 +61,11 @@ class HubSpotFormDefinitionAllOfLegalConsentOptions implements ModelInterface, A 'subscription_type_ids' => 'int[]', 'lawful_basis' => 'string', 'privacy_text' => 'string', - 'communication_consent_text' => 'string', 'communications_checkboxes' => '\HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[]', - 'consent_to_process_text' => 'string', + 'communication_consent_text' => 'string', 'consent_to_process_checkbox_label' => 'string', - 'consent_to_process_footer_text' => 'string' + 'consent_to_process_footer_text' => 'string', + 'consent_to_process_text' => 'string' ]; /** @@ -80,11 +80,11 @@ class HubSpotFormDefinitionAllOfLegalConsentOptions implements ModelInterface, A 'subscription_type_ids' => 'int64', 'lawful_basis' => null, 'privacy_text' => null, - 'communication_consent_text' => null, 'communications_checkboxes' => null, - 'consent_to_process_text' => null, + 'communication_consent_text' => null, 'consent_to_process_checkbox_label' => null, - 'consent_to_process_footer_text' => null + 'consent_to_process_footer_text' => null, + 'consent_to_process_text' => null ]; /** @@ -97,11 +97,11 @@ class HubSpotFormDefinitionAllOfLegalConsentOptions implements ModelInterface, A 'subscription_type_ids' => false, 'lawful_basis' => false, 'privacy_text' => false, - 'communication_consent_text' => false, 'communications_checkboxes' => false, - 'consent_to_process_text' => false, + 'communication_consent_text' => false, 'consent_to_process_checkbox_label' => false, - 'consent_to_process_footer_text' => false + 'consent_to_process_footer_text' => false, + 'consent_to_process_text' => false ]; /** @@ -194,11 +194,11 @@ public function isNullableSetToNull(string $property): bool 'subscription_type_ids' => 'subscriptionTypeIds', 'lawful_basis' => 'lawfulBasis', 'privacy_text' => 'privacyText', - 'communication_consent_text' => 'communicationConsentText', 'communications_checkboxes' => 'communicationsCheckboxes', - 'consent_to_process_text' => 'consentToProcessText', + 'communication_consent_text' => 'communicationConsentText', 'consent_to_process_checkbox_label' => 'consentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'consentToProcessFooterText' + 'consent_to_process_footer_text' => 'consentToProcessFooterText', + 'consent_to_process_text' => 'consentToProcessText' ]; /** @@ -211,11 +211,11 @@ public function isNullableSetToNull(string $property): bool 'subscription_type_ids' => 'setSubscriptionTypeIds', 'lawful_basis' => 'setLawfulBasis', 'privacy_text' => 'setPrivacyText', - 'communication_consent_text' => 'setCommunicationConsentText', 'communications_checkboxes' => 'setCommunicationsCheckboxes', - 'consent_to_process_text' => 'setConsentToProcessText', + 'communication_consent_text' => 'setCommunicationConsentText', 'consent_to_process_checkbox_label' => 'setConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'setConsentToProcessFooterText' + 'consent_to_process_footer_text' => 'setConsentToProcessFooterText', + 'consent_to_process_text' => 'setConsentToProcessText' ]; /** @@ -228,11 +228,11 @@ public function isNullableSetToNull(string $property): bool 'subscription_type_ids' => 'getSubscriptionTypeIds', 'lawful_basis' => 'getLawfulBasis', 'privacy_text' => 'getPrivacyText', - 'communication_consent_text' => 'getCommunicationConsentText', 'communications_checkboxes' => 'getCommunicationsCheckboxes', - 'consent_to_process_text' => 'getConsentToProcessText', + 'communication_consent_text' => 'getCommunicationConsentText', 'consent_to_process_checkbox_label' => 'getConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'getConsentToProcessFooterText' + 'consent_to_process_footer_text' => 'getConsentToProcessFooterText', + 'consent_to_process_text' => 'getConsentToProcessText' ]; /** @@ -323,20 +323,20 @@ public function getLawfulBasisAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type', $data ?? [], 'none'); $this->setIfExists('subscription_type_ids', $data ?? [], null); $this->setIfExists('lawful_basis', $data ?? [], null); $this->setIfExists('privacy_text', $data ?? [], null); - $this->setIfExists('communication_consent_text', $data ?? [], null); $this->setIfExists('communications_checkboxes', $data ?? [], null); - $this->setIfExists('consent_to_process_text', $data ?? [], null); + $this->setIfExists('communication_consent_text', $data ?? [], null); $this->setIfExists('consent_to_process_checkbox_label', $data ?? [], null); $this->setIfExists('consent_to_process_footer_text', $data ?? [], null); + $this->setIfExists('consent_to_process_text', $data ?? [], null); } /** @@ -427,7 +427,7 @@ public function getType() /** * Sets type * - * @param string $type type + * @param string $type * * @return self */ @@ -464,7 +464,7 @@ public function getSubscriptionTypeIds() /** * Sets subscription_type_ids * - * @param int[] $subscription_type_ids subscription_type_ids + * @param int[] $subscription_type_ids * * @return self */ @@ -491,7 +491,7 @@ public function getLawfulBasis() /** * Sets lawful_basis * - * @param string $lawful_basis lawful_basis + * @param string $lawful_basis * * @return self */ @@ -528,7 +528,7 @@ public function getPrivacyText() /** * Sets privacy_text * - * @param string $privacy_text privacy_text + * @param string $privacy_text * * @return self */ @@ -542,33 +542,6 @@ public function setPrivacyText($privacy_text) return $this; } - /** - * Gets communication_consent_text - * - * @return string|null - */ - public function getCommunicationConsentText() - { - return $this->container['communication_consent_text']; - } - - /** - * Sets communication_consent_text - * - * @param string|null $communication_consent_text communication_consent_text - * - * @return self - */ - public function setCommunicationConsentText($communication_consent_text) - { - if (is_null($communication_consent_text)) { - throw new \InvalidArgumentException('non-nullable communication_consent_text cannot be null'); - } - $this->container['communication_consent_text'] = $communication_consent_text; - - return $this; - } - /** * Gets communications_checkboxes * @@ -582,7 +555,7 @@ public function getCommunicationsCheckboxes() /** * Sets communications_checkboxes * - * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes communications_checkboxes + * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes * * @return self */ @@ -597,28 +570,28 @@ public function setCommunicationsCheckboxes($communications_checkboxes) } /** - * Gets consent_to_process_text + * Gets communication_consent_text * * @return string|null */ - public function getConsentToProcessText() + public function getCommunicationConsentText() { - return $this->container['consent_to_process_text']; + return $this->container['communication_consent_text']; } /** - * Sets consent_to_process_text + * Sets communication_consent_text * - * @param string|null $consent_to_process_text consent_to_process_text + * @param string|null $communication_consent_text * * @return self */ - public function setConsentToProcessText($consent_to_process_text) + public function setCommunicationConsentText($communication_consent_text) { - if (is_null($consent_to_process_text)) { - throw new \InvalidArgumentException('non-nullable consent_to_process_text cannot be null'); + if (is_null($communication_consent_text)) { + throw new \InvalidArgumentException('non-nullable communication_consent_text cannot be null'); } - $this->container['consent_to_process_text'] = $consent_to_process_text; + $this->container['communication_consent_text'] = $communication_consent_text; return $this; } @@ -636,7 +609,7 @@ public function getConsentToProcessCheckboxLabel() /** * Sets consent_to_process_checkbox_label * - * @param string|null $consent_to_process_checkbox_label consent_to_process_checkbox_label + * @param string|null $consent_to_process_checkbox_label * * @return self */ @@ -663,7 +636,7 @@ public function getConsentToProcessFooterText() /** * Sets consent_to_process_footer_text * - * @param string|null $consent_to_process_footer_text consent_to_process_footer_text + * @param string|null $consent_to_process_footer_text * * @return self */ @@ -676,6 +649,33 @@ public function setConsentToProcessFooterText($consent_to_process_footer_text) return $this; } + + /** + * Gets consent_to_process_text + * + * @return string|null + */ + public function getConsentToProcessText() + { + return $this->container['consent_to_process_text']; + } + + /** + * Sets consent_to_process_text + * + * @param string|null $consent_to_process_text + * + * @return self + */ + public function setConsentToProcessText($consent_to_process_text) + { + if (is_null($consent_to_process_text)) { + throw new \InvalidArgumentException('non-nullable consent_to_process_text cannot be null'); + } + $this->container['consent_to_process_text'] = $consent_to_process_text; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequest.php b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequest.php index 16d6ada67..7d7fcdcff 100644 --- a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequest.php +++ b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -306,10 +306,10 @@ public function getFormTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('form_type', $data ?? [], 'hubspot'); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php index 35204dc0f..c5cf9c0fa 100644 --- a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php +++ b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -61,11 +61,11 @@ class HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions implements Mode 'subscription_type_ids' => 'int[]', 'lawful_basis' => 'string', 'privacy_text' => 'string', - 'communication_consent_text' => 'string', 'communications_checkboxes' => '\HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[]', - 'consent_to_process_text' => 'string', + 'communication_consent_text' => 'string', 'consent_to_process_checkbox_label' => 'string', - 'consent_to_process_footer_text' => 'string' + 'consent_to_process_footer_text' => 'string', + 'consent_to_process_text' => 'string' ]; /** @@ -80,11 +80,11 @@ class HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions implements Mode 'subscription_type_ids' => 'int64', 'lawful_basis' => null, 'privacy_text' => null, - 'communication_consent_text' => null, 'communications_checkboxes' => null, - 'consent_to_process_text' => null, + 'communication_consent_text' => null, 'consent_to_process_checkbox_label' => null, - 'consent_to_process_footer_text' => null + 'consent_to_process_footer_text' => null, + 'consent_to_process_text' => null ]; /** @@ -97,11 +97,11 @@ class HubSpotFormDefinitionCreateRequestAllOfLegalConsentOptions implements Mode 'subscription_type_ids' => false, 'lawful_basis' => false, 'privacy_text' => false, - 'communication_consent_text' => false, 'communications_checkboxes' => false, - 'consent_to_process_text' => false, + 'communication_consent_text' => false, 'consent_to_process_checkbox_label' => false, - 'consent_to_process_footer_text' => false + 'consent_to_process_footer_text' => false, + 'consent_to_process_text' => false ]; /** @@ -194,11 +194,11 @@ public function isNullableSetToNull(string $property): bool 'subscription_type_ids' => 'subscriptionTypeIds', 'lawful_basis' => 'lawfulBasis', 'privacy_text' => 'privacyText', - 'communication_consent_text' => 'communicationConsentText', 'communications_checkboxes' => 'communicationsCheckboxes', - 'consent_to_process_text' => 'consentToProcessText', + 'communication_consent_text' => 'communicationConsentText', 'consent_to_process_checkbox_label' => 'consentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'consentToProcessFooterText' + 'consent_to_process_footer_text' => 'consentToProcessFooterText', + 'consent_to_process_text' => 'consentToProcessText' ]; /** @@ -211,11 +211,11 @@ public function isNullableSetToNull(string $property): bool 'subscription_type_ids' => 'setSubscriptionTypeIds', 'lawful_basis' => 'setLawfulBasis', 'privacy_text' => 'setPrivacyText', - 'communication_consent_text' => 'setCommunicationConsentText', 'communications_checkboxes' => 'setCommunicationsCheckboxes', - 'consent_to_process_text' => 'setConsentToProcessText', + 'communication_consent_text' => 'setCommunicationConsentText', 'consent_to_process_checkbox_label' => 'setConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'setConsentToProcessFooterText' + 'consent_to_process_footer_text' => 'setConsentToProcessFooterText', + 'consent_to_process_text' => 'setConsentToProcessText' ]; /** @@ -228,11 +228,11 @@ public function isNullableSetToNull(string $property): bool 'subscription_type_ids' => 'getSubscriptionTypeIds', 'lawful_basis' => 'getLawfulBasis', 'privacy_text' => 'getPrivacyText', - 'communication_consent_text' => 'getCommunicationConsentText', 'communications_checkboxes' => 'getCommunicationsCheckboxes', - 'consent_to_process_text' => 'getConsentToProcessText', + 'communication_consent_text' => 'getCommunicationConsentText', 'consent_to_process_checkbox_label' => 'getConsentToProcessCheckboxLabel', - 'consent_to_process_footer_text' => 'getConsentToProcessFooterText' + 'consent_to_process_footer_text' => 'getConsentToProcessFooterText', + 'consent_to_process_text' => 'getConsentToProcessText' ]; /** @@ -323,20 +323,20 @@ public function getLawfulBasisAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type', $data ?? [], 'none'); $this->setIfExists('subscription_type_ids', $data ?? [], null); $this->setIfExists('lawful_basis', $data ?? [], null); $this->setIfExists('privacy_text', $data ?? [], null); - $this->setIfExists('communication_consent_text', $data ?? [], null); $this->setIfExists('communications_checkboxes', $data ?? [], null); - $this->setIfExists('consent_to_process_text', $data ?? [], null); + $this->setIfExists('communication_consent_text', $data ?? [], null); $this->setIfExists('consent_to_process_checkbox_label', $data ?? [], null); $this->setIfExists('consent_to_process_footer_text', $data ?? [], null); + $this->setIfExists('consent_to_process_text', $data ?? [], null); } /** @@ -427,7 +427,7 @@ public function getType() /** * Sets type * - * @param string $type type + * @param string $type * * @return self */ @@ -464,7 +464,7 @@ public function getSubscriptionTypeIds() /** * Sets subscription_type_ids * - * @param int[] $subscription_type_ids subscription_type_ids + * @param int[] $subscription_type_ids * * @return self */ @@ -491,7 +491,7 @@ public function getLawfulBasis() /** * Sets lawful_basis * - * @param string $lawful_basis lawful_basis + * @param string $lawful_basis * * @return self */ @@ -528,7 +528,7 @@ public function getPrivacyText() /** * Sets privacy_text * - * @param string $privacy_text privacy_text + * @param string $privacy_text * * @return self */ @@ -542,33 +542,6 @@ public function setPrivacyText($privacy_text) return $this; } - /** - * Gets communication_consent_text - * - * @return string|null - */ - public function getCommunicationConsentText() - { - return $this->container['communication_consent_text']; - } - - /** - * Sets communication_consent_text - * - * @param string|null $communication_consent_text communication_consent_text - * - * @return self - */ - public function setCommunicationConsentText($communication_consent_text) - { - if (is_null($communication_consent_text)) { - throw new \InvalidArgumentException('non-nullable communication_consent_text cannot be null'); - } - $this->container['communication_consent_text'] = $communication_consent_text; - - return $this; - } - /** * Gets communications_checkboxes * @@ -582,7 +555,7 @@ public function getCommunicationsCheckboxes() /** * Sets communications_checkboxes * - * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes communications_checkboxes + * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes * * @return self */ @@ -597,28 +570,28 @@ public function setCommunicationsCheckboxes($communications_checkboxes) } /** - * Gets consent_to_process_text + * Gets communication_consent_text * * @return string|null */ - public function getConsentToProcessText() + public function getCommunicationConsentText() { - return $this->container['consent_to_process_text']; + return $this->container['communication_consent_text']; } /** - * Sets consent_to_process_text + * Sets communication_consent_text * - * @param string|null $consent_to_process_text consent_to_process_text + * @param string|null $communication_consent_text * * @return self */ - public function setConsentToProcessText($consent_to_process_text) + public function setCommunicationConsentText($communication_consent_text) { - if (is_null($consent_to_process_text)) { - throw new \InvalidArgumentException('non-nullable consent_to_process_text cannot be null'); + if (is_null($communication_consent_text)) { + throw new \InvalidArgumentException('non-nullable communication_consent_text cannot be null'); } - $this->container['consent_to_process_text'] = $consent_to_process_text; + $this->container['communication_consent_text'] = $communication_consent_text; return $this; } @@ -636,7 +609,7 @@ public function getConsentToProcessCheckboxLabel() /** * Sets consent_to_process_checkbox_label * - * @param string|null $consent_to_process_checkbox_label consent_to_process_checkbox_label + * @param string|null $consent_to_process_checkbox_label * * @return self */ @@ -663,7 +636,7 @@ public function getConsentToProcessFooterText() /** * Sets consent_to_process_footer_text * - * @param string|null $consent_to_process_footer_text consent_to_process_footer_text + * @param string|null $consent_to_process_footer_text * * @return self */ @@ -676,6 +649,33 @@ public function setConsentToProcessFooterText($consent_to_process_footer_text) return $this; } + + /** + * Gets consent_to_process_text + * + * @return string|null + */ + public function getConsentToProcessText() + { + return $this->container['consent_to_process_text']; + } + + /** + * Sets consent_to_process_text + * + * @param string|null $consent_to_process_text + * + * @return self + */ + public function setConsentToProcessText($consent_to_process_text) + { + if (is_null($consent_to_process_text)) { + throw new \InvalidArgumentException('non-nullable consent_to_process_text cannot be null'); + } + $this->container['consent_to_process_text'] = $consent_to_process_text; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionPatchRequest.php b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionPatchRequest.php index 93d9576ec..4f12e5b6c 100644 --- a/codegen/Marketing/Forms/Model/HubSpotFormDefinitionPatchRequest.php +++ b/codegen/Marketing/Forms/Model/HubSpotFormDefinitionPatchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('field_groups', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/LegalConsentCheckbox.php b/codegen/Marketing/Forms/Model/LegalConsentCheckbox.php index 2aca9e240..80ceff907 100644 --- a/codegen/Marketing/Forms/Model/LegalConsentCheckbox.php +++ b/codegen/Marketing/Forms/Model/LegalConsentCheckbox.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,9 +57,9 @@ class LegalConsentCheckbox implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ - 'required' => 'bool', 'subscription_type_id' => 'int', - 'label' => 'string' + 'label' => 'string', + 'required' => 'bool' ]; /** @@ -70,9 +70,9 @@ class LegalConsentCheckbox implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ - 'required' => null, 'subscription_type_id' => 'int32', - 'label' => null + 'label' => null, + 'required' => null ]; /** @@ -81,9 +81,9 @@ class LegalConsentCheckbox implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'required' => false, 'subscription_type_id' => false, - 'label' => false + 'label' => false, + 'required' => false ]; /** @@ -172,9 +172,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'required' => 'required', 'subscription_type_id' => 'subscriptionTypeId', - 'label' => 'label' + 'label' => 'label', + 'required' => 'required' ]; /** @@ -183,9 +183,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'required' => 'setRequired', 'subscription_type_id' => 'setSubscriptionTypeId', - 'label' => 'setLabel' + 'label' => 'setLabel', + 'required' => 'setRequired' ]; /** @@ -194,9 +194,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'required' => 'getRequired', 'subscription_type_id' => 'getSubscriptionTypeId', - 'label' => 'getLabel' + 'label' => 'getLabel', + 'required' => 'getRequired' ]; /** @@ -251,14 +251,14 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('required', $data ?? [], null); $this->setIfExists('subscription_type_id', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); } /** @@ -288,15 +288,15 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['required'] === null) { - $invalidProperties[] = "'required' can't be null"; - } if ($this->container['subscription_type_id'] === null) { $invalidProperties[] = "'subscription_type_id' can't be null"; } if ($this->container['label'] === null) { $invalidProperties[] = "'label' can't be null"; } + if ($this->container['required'] === null) { + $invalidProperties[] = "'required' can't be null"; + } return $invalidProperties; } @@ -312,33 +312,6 @@ public function valid() } - /** - * Gets required - * - * @return bool - */ - public function getRequired() - { - return $this->container['required']; - } - - /** - * Sets required - * - * @param bool $required Whether this checkbox is required when submitting the form. - * - * @return self - */ - public function setRequired($required) - { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); - } - $this->container['required'] = $required; - - return $this; - } - /** * Gets subscription_type_id * @@ -352,7 +325,7 @@ public function getSubscriptionTypeId() /** * Sets subscription_type_id * - * @param int $subscription_type_id subscription_type_id + * @param int $subscription_type_id * * @return self */ @@ -392,6 +365,33 @@ public function setLabel($label) return $this; } + + /** + * Gets required + * + * @return bool + */ + public function getRequired() + { + return $this->container['required']; + } + + /** + * Sets required + * + * @param bool $required Whether this checkbox is required when submitting the form. + * + * @return self + */ + public function setRequired($required) + { + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); + } + $this->container['required'] = $required; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/codegen/Marketing/Forms/Model/LegalConsentOptionsExplicitConsentToProcess.php b/codegen/Marketing/Forms/Model/LegalConsentOptionsExplicitConsentToProcess.php index e7f86b9dc..9d970424d 100644 --- a/codegen/Marketing/Forms/Model/LegalConsentOptionsExplicitConsentToProcess.php +++ b/codegen/Marketing/Forms/Model/LegalConsentOptionsExplicitConsentToProcess.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,13 +57,13 @@ class LegalConsentOptionsExplicitConsentToProcess implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'type' => 'string', - 'communication_consent_text' => 'string', 'communications_checkboxes' => '\HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[]', - 'consent_to_process_text' => 'string', + 'communication_consent_text' => 'string', 'consent_to_process_checkbox_label' => 'string', 'consent_to_process_footer_text' => 'string', - 'privacy_text' => 'string' + 'type' => 'string', + 'privacy_text' => 'string', + 'consent_to_process_text' => 'string' ]; /** @@ -74,13 +74,13 @@ class LegalConsentOptionsExplicitConsentToProcess implements ModelInterface, Arr * @psalm-var array */ protected static $openAPIFormats = [ - 'type' => null, - 'communication_consent_text' => null, 'communications_checkboxes' => null, - 'consent_to_process_text' => null, + 'communication_consent_text' => null, 'consent_to_process_checkbox_label' => null, 'consent_to_process_footer_text' => null, - 'privacy_text' => null + 'type' => null, + 'privacy_text' => null, + 'consent_to_process_text' => null ]; /** @@ -89,13 +89,13 @@ class LegalConsentOptionsExplicitConsentToProcess implements ModelInterface, Arr * @var boolean[] */ protected static array $openAPINullables = [ - 'type' => false, - 'communication_consent_text' => false, 'communications_checkboxes' => false, - 'consent_to_process_text' => false, + 'communication_consent_text' => false, 'consent_to_process_checkbox_label' => false, 'consent_to_process_footer_text' => false, - 'privacy_text' => false + 'type' => false, + 'privacy_text' => false, + 'consent_to_process_text' => false ]; /** @@ -184,13 +184,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'type' => 'type', - 'communication_consent_text' => 'communicationConsentText', 'communications_checkboxes' => 'communicationsCheckboxes', - 'consent_to_process_text' => 'consentToProcessText', + 'communication_consent_text' => 'communicationConsentText', 'consent_to_process_checkbox_label' => 'consentToProcessCheckboxLabel', 'consent_to_process_footer_text' => 'consentToProcessFooterText', - 'privacy_text' => 'privacyText' + 'type' => 'type', + 'privacy_text' => 'privacyText', + 'consent_to_process_text' => 'consentToProcessText' ]; /** @@ -199,13 +199,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'type' => 'setType', - 'communication_consent_text' => 'setCommunicationConsentText', 'communications_checkboxes' => 'setCommunicationsCheckboxes', - 'consent_to_process_text' => 'setConsentToProcessText', + 'communication_consent_text' => 'setCommunicationConsentText', 'consent_to_process_checkbox_label' => 'setConsentToProcessCheckboxLabel', 'consent_to_process_footer_text' => 'setConsentToProcessFooterText', - 'privacy_text' => 'setPrivacyText' + 'type' => 'setType', + 'privacy_text' => 'setPrivacyText', + 'consent_to_process_text' => 'setConsentToProcessText' ]; /** @@ -214,13 +214,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'type' => 'getType', - 'communication_consent_text' => 'getCommunicationConsentText', 'communications_checkboxes' => 'getCommunicationsCheckboxes', - 'consent_to_process_text' => 'getConsentToProcessText', + 'communication_consent_text' => 'getCommunicationConsentText', 'consent_to_process_checkbox_label' => 'getConsentToProcessCheckboxLabel', 'consent_to_process_footer_text' => 'getConsentToProcessFooterText', - 'privacy_text' => 'getPrivacyText' + 'type' => 'getType', + 'privacy_text' => 'getPrivacyText', + 'consent_to_process_text' => 'getConsentToProcessText' ]; /** @@ -288,18 +288,18 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('type', $data ?? [], 'explicit_consent_to_process'); - $this->setIfExists('communication_consent_text', $data ?? [], null); $this->setIfExists('communications_checkboxes', $data ?? [], null); - $this->setIfExists('consent_to_process_text', $data ?? [], null); + $this->setIfExists('communication_consent_text', $data ?? [], null); $this->setIfExists('consent_to_process_checkbox_label', $data ?? [], null); $this->setIfExists('consent_to_process_footer_text', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'explicit_consent_to_process'); $this->setIfExists('privacy_text', $data ?? [], null); + $this->setIfExists('consent_to_process_text', $data ?? [], null); } /** @@ -329,6 +329,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['communications_checkboxes'] === null) { + $invalidProperties[] = "'communications_checkboxes' can't be null"; + } if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } @@ -341,9 +344,6 @@ public function listInvalidProperties() ); } - if ($this->container['communications_checkboxes'] === null) { - $invalidProperties[] = "'communications_checkboxes' can't be null"; - } if ($this->container['privacy_text'] === null) { $invalidProperties[] = "'privacy_text' can't be null"; } @@ -363,38 +363,28 @@ public function valid() /** - * Gets type + * Gets communications_checkboxes * - * @return string + * @return \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] */ - public function getType() + public function getCommunicationsCheckboxes() { - return $this->container['type']; + return $this->container['communications_checkboxes']; } /** - * Sets type + * Sets communications_checkboxes * - * @param string $type type + * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes * * @return self */ - public function setType($type) + public function setCommunicationsCheckboxes($communications_checkboxes) { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'type', must be one of '%s'", - $type, - implode("', '", $allowedValues) - ) - ); + if (is_null($communications_checkboxes)) { + throw new \InvalidArgumentException('non-nullable communications_checkboxes cannot be null'); } - $this->container['type'] = $type; + $this->container['communications_checkboxes'] = $communications_checkboxes; return $this; } @@ -412,7 +402,7 @@ public function getCommunicationConsentText() /** * Sets communication_consent_text * - * @param string|null $communication_consent_text communication_consent_text + * @param string|null $communication_consent_text * * @return self */ @@ -427,136 +417,146 @@ public function setCommunicationConsentText($communication_consent_text) } /** - * Gets communications_checkboxes + * Gets consent_to_process_checkbox_label * - * @return \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] + * @return string|null */ - public function getCommunicationsCheckboxes() + public function getConsentToProcessCheckboxLabel() { - return $this->container['communications_checkboxes']; + return $this->container['consent_to_process_checkbox_label']; } /** - * Sets communications_checkboxes + * Sets consent_to_process_checkbox_label * - * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes communications_checkboxes + * @param string|null $consent_to_process_checkbox_label * * @return self */ - public function setCommunicationsCheckboxes($communications_checkboxes) + public function setConsentToProcessCheckboxLabel($consent_to_process_checkbox_label) { - if (is_null($communications_checkboxes)) { - throw new \InvalidArgumentException('non-nullable communications_checkboxes cannot be null'); + if (is_null($consent_to_process_checkbox_label)) { + throw new \InvalidArgumentException('non-nullable consent_to_process_checkbox_label cannot be null'); } - $this->container['communications_checkboxes'] = $communications_checkboxes; + $this->container['consent_to_process_checkbox_label'] = $consent_to_process_checkbox_label; return $this; } /** - * Gets consent_to_process_text + * Gets consent_to_process_footer_text * * @return string|null */ - public function getConsentToProcessText() + public function getConsentToProcessFooterText() { - return $this->container['consent_to_process_text']; + return $this->container['consent_to_process_footer_text']; } /** - * Sets consent_to_process_text + * Sets consent_to_process_footer_text * - * @param string|null $consent_to_process_text consent_to_process_text + * @param string|null $consent_to_process_footer_text * * @return self */ - public function setConsentToProcessText($consent_to_process_text) + public function setConsentToProcessFooterText($consent_to_process_footer_text) { - if (is_null($consent_to_process_text)) { - throw new \InvalidArgumentException('non-nullable consent_to_process_text cannot be null'); + if (is_null($consent_to_process_footer_text)) { + throw new \InvalidArgumentException('non-nullable consent_to_process_footer_text cannot be null'); } - $this->container['consent_to_process_text'] = $consent_to_process_text; + $this->container['consent_to_process_footer_text'] = $consent_to_process_footer_text; return $this; } /** - * Gets consent_to_process_checkbox_label + * Gets type * - * @return string|null + * @return string */ - public function getConsentToProcessCheckboxLabel() + public function getType() { - return $this->container['consent_to_process_checkbox_label']; + return $this->container['type']; } /** - * Sets consent_to_process_checkbox_label + * Sets type * - * @param string|null $consent_to_process_checkbox_label consent_to_process_checkbox_label + * @param string $type * * @return self */ - public function setConsentToProcessCheckboxLabel($consent_to_process_checkbox_label) + public function setType($type) { - if (is_null($consent_to_process_checkbox_label)) { - throw new \InvalidArgumentException('non-nullable consent_to_process_checkbox_label cannot be null'); + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); } - $this->container['consent_to_process_checkbox_label'] = $consent_to_process_checkbox_label; + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; return $this; } /** - * Gets consent_to_process_footer_text + * Gets privacy_text * - * @return string|null + * @return string */ - public function getConsentToProcessFooterText() + public function getPrivacyText() { - return $this->container['consent_to_process_footer_text']; + return $this->container['privacy_text']; } /** - * Sets consent_to_process_footer_text + * Sets privacy_text * - * @param string|null $consent_to_process_footer_text consent_to_process_footer_text + * @param string $privacy_text * * @return self */ - public function setConsentToProcessFooterText($consent_to_process_footer_text) + public function setPrivacyText($privacy_text) { - if (is_null($consent_to_process_footer_text)) { - throw new \InvalidArgumentException('non-nullable consent_to_process_footer_text cannot be null'); + if (is_null($privacy_text)) { + throw new \InvalidArgumentException('non-nullable privacy_text cannot be null'); } - $this->container['consent_to_process_footer_text'] = $consent_to_process_footer_text; + $this->container['privacy_text'] = $privacy_text; return $this; } /** - * Gets privacy_text + * Gets consent_to_process_text * - * @return string + * @return string|null */ - public function getPrivacyText() + public function getConsentToProcessText() { - return $this->container['privacy_text']; + return $this->container['consent_to_process_text']; } /** - * Sets privacy_text + * Sets consent_to_process_text * - * @param string $privacy_text privacy_text + * @param string|null $consent_to_process_text * * @return self */ - public function setPrivacyText($privacy_text) + public function setConsentToProcessText($consent_to_process_text) { - if (is_null($privacy_text)) { - throw new \InvalidArgumentException('non-nullable privacy_text cannot be null'); + if (is_null($consent_to_process_text)) { + throw new \InvalidArgumentException('non-nullable consent_to_process_text cannot be null'); } - $this->container['privacy_text'] = $privacy_text; + $this->container['consent_to_process_text'] = $consent_to_process_text; return $this; } diff --git a/codegen/Marketing/Forms/Model/LegalConsentOptionsImplicitConsentToProcess.php b/codegen/Marketing/Forms/Model/LegalConsentOptionsImplicitConsentToProcess.php index affca76a7..68af1e625 100644 --- a/codegen/Marketing/Forms/Model/LegalConsentOptionsImplicitConsentToProcess.php +++ b/codegen/Marketing/Forms/Model/LegalConsentOptionsImplicitConsentToProcess.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,9 +57,9 @@ class LegalConsentOptionsImplicitConsentToProcess implements ModelInterface, Arr * @var string[] */ protected static $openAPITypes = [ - 'type' => 'string', - 'communication_consent_text' => 'string', 'communications_checkboxes' => '\HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[]', + 'communication_consent_text' => 'string', + 'type' => 'string', 'privacy_text' => 'string', 'consent_to_process_text' => 'string' ]; @@ -72,9 +72,9 @@ class LegalConsentOptionsImplicitConsentToProcess implements ModelInterface, Arr * @psalm-var array */ protected static $openAPIFormats = [ - 'type' => null, - 'communication_consent_text' => null, 'communications_checkboxes' => null, + 'communication_consent_text' => null, + 'type' => null, 'privacy_text' => null, 'consent_to_process_text' => null ]; @@ -85,9 +85,9 @@ class LegalConsentOptionsImplicitConsentToProcess implements ModelInterface, Arr * @var boolean[] */ protected static array $openAPINullables = [ - 'type' => false, - 'communication_consent_text' => false, 'communications_checkboxes' => false, + 'communication_consent_text' => false, + 'type' => false, 'privacy_text' => false, 'consent_to_process_text' => false ]; @@ -178,9 +178,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'type' => 'type', - 'communication_consent_text' => 'communicationConsentText', 'communications_checkboxes' => 'communicationsCheckboxes', + 'communication_consent_text' => 'communicationConsentText', + 'type' => 'type', 'privacy_text' => 'privacyText', 'consent_to_process_text' => 'consentToProcessText' ]; @@ -191,9 +191,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'type' => 'setType', - 'communication_consent_text' => 'setCommunicationConsentText', 'communications_checkboxes' => 'setCommunicationsCheckboxes', + 'communication_consent_text' => 'setCommunicationConsentText', + 'type' => 'setType', 'privacy_text' => 'setPrivacyText', 'consent_to_process_text' => 'setConsentToProcessText' ]; @@ -204,9 +204,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'type' => 'getType', - 'communication_consent_text' => 'getCommunicationConsentText', 'communications_checkboxes' => 'getCommunicationsCheckboxes', + 'communication_consent_text' => 'getCommunicationConsentText', + 'type' => 'getType', 'privacy_text' => 'getPrivacyText', 'consent_to_process_text' => 'getConsentToProcessText' ]; @@ -276,14 +276,14 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('type', $data ?? [], 'implicit_consent_to_process'); - $this->setIfExists('communication_consent_text', $data ?? [], null); $this->setIfExists('communications_checkboxes', $data ?? [], null); + $this->setIfExists('communication_consent_text', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'implicit_consent_to_process'); $this->setIfExists('privacy_text', $data ?? [], null); $this->setIfExists('consent_to_process_text', $data ?? [], null); } @@ -315,6 +315,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['communications_checkboxes'] === null) { + $invalidProperties[] = "'communications_checkboxes' can't be null"; + } if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } @@ -327,9 +330,6 @@ public function listInvalidProperties() ); } - if ($this->container['communications_checkboxes'] === null) { - $invalidProperties[] = "'communications_checkboxes' can't be null"; - } if ($this->container['privacy_text'] === null) { $invalidProperties[] = "'privacy_text' can't be null"; } @@ -349,38 +349,28 @@ public function valid() /** - * Gets type + * Gets communications_checkboxes * - * @return string + * @return \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] */ - public function getType() + public function getCommunicationsCheckboxes() { - return $this->container['type']; + return $this->container['communications_checkboxes']; } /** - * Sets type + * Sets communications_checkboxes * - * @param string $type type + * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes * * @return self */ - public function setType($type) + public function setCommunicationsCheckboxes($communications_checkboxes) { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'type', must be one of '%s'", - $type, - implode("', '", $allowedValues) - ) - ); + if (is_null($communications_checkboxes)) { + throw new \InvalidArgumentException('non-nullable communications_checkboxes cannot be null'); } - $this->container['type'] = $type; + $this->container['communications_checkboxes'] = $communications_checkboxes; return $this; } @@ -398,7 +388,7 @@ public function getCommunicationConsentText() /** * Sets communication_consent_text * - * @param string|null $communication_consent_text communication_consent_text + * @param string|null $communication_consent_text * * @return self */ @@ -413,28 +403,38 @@ public function setCommunicationConsentText($communication_consent_text) } /** - * Gets communications_checkboxes + * Gets type * - * @return \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] + * @return string */ - public function getCommunicationsCheckboxes() + public function getType() { - return $this->container['communications_checkboxes']; + return $this->container['type']; } /** - * Sets communications_checkboxes + * Sets type * - * @param \HubSpot\Client\Marketing\Forms\Model\LegalConsentCheckbox[] $communications_checkboxes communications_checkboxes + * @param string $type * * @return self */ - public function setCommunicationsCheckboxes($communications_checkboxes) + public function setType($type) { - if (is_null($communications_checkboxes)) { - throw new \InvalidArgumentException('non-nullable communications_checkboxes cannot be null'); + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); } - $this->container['communications_checkboxes'] = $communications_checkboxes; + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; return $this; } @@ -452,7 +452,7 @@ public function getPrivacyText() /** * Sets privacy_text * - * @param string $privacy_text privacy_text + * @param string $privacy_text * * @return self */ @@ -479,7 +479,7 @@ public function getConsentToProcessText() /** * Sets consent_to_process_text * - * @param string|null $consent_to_process_text consent_to_process_text + * @param string|null $consent_to_process_text * * @return self */ diff --git a/codegen/Marketing/Forms/Model/LegalConsentOptionsLegitimateInterest.php b/codegen/Marketing/Forms/Model/LegalConsentOptionsLegitimateInterest.php index 318192c45..bc7032c89 100644 --- a/codegen/Marketing/Forms/Model/LegalConsentOptionsLegitimateInterest.php +++ b/codegen/Marketing/Forms/Model/LegalConsentOptionsLegitimateInterest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,9 +57,9 @@ class LegalConsentOptionsLegitimateInterest implements ModelInterface, ArrayAcce * @var string[] */ protected static $openAPITypes = [ - 'type' => 'string', 'subscription_type_ids' => 'int[]', 'lawful_basis' => 'string', + 'type' => 'string', 'privacy_text' => 'string' ]; @@ -71,9 +71,9 @@ class LegalConsentOptionsLegitimateInterest implements ModelInterface, ArrayAcce * @psalm-var array */ protected static $openAPIFormats = [ - 'type' => null, 'subscription_type_ids' => 'int64', 'lawful_basis' => null, + 'type' => null, 'privacy_text' => null ]; @@ -83,9 +83,9 @@ class LegalConsentOptionsLegitimateInterest implements ModelInterface, ArrayAcce * @var boolean[] */ protected static array $openAPINullables = [ - 'type' => false, 'subscription_type_ids' => false, 'lawful_basis' => false, + 'type' => false, 'privacy_text' => false ]; @@ -175,9 +175,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'type' => 'type', 'subscription_type_ids' => 'subscriptionTypeIds', 'lawful_basis' => 'lawfulBasis', + 'type' => 'type', 'privacy_text' => 'privacyText' ]; @@ -187,9 +187,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'type' => 'setType', 'subscription_type_ids' => 'setSubscriptionTypeIds', 'lawful_basis' => 'setLawfulBasis', + 'type' => 'setType', 'privacy_text' => 'setPrivacyText' ]; @@ -199,9 +199,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'type' => 'getType', 'subscription_type_ids' => 'getSubscriptionTypeIds', 'lawful_basis' => 'getLawfulBasis', + 'type' => 'getType', 'privacy_text' => 'getPrivacyText' ]; @@ -246,20 +246,22 @@ public function getModelName() return self::$openAPIModelName; } - public const TYPE_LEGITIMATE_INTEREST = 'legitimate_interest'; public const LAWFUL_BASIS_LEAD = 'lead'; public const LAWFUL_BASIS_CLIENT = 'client'; public const LAWFUL_BASIS_OTHER = 'other'; + public const TYPE_LEGITIMATE_INTEREST = 'legitimate_interest'; /** * Gets allowable values of the enum * * @return string[] */ - public function getTypeAllowableValues() + public function getLawfulBasisAllowableValues() { return [ - self::TYPE_LEGITIMATE_INTEREST, + self::LAWFUL_BASIS_LEAD, + self::LAWFUL_BASIS_CLIENT, + self::LAWFUL_BASIS_OTHER, ]; } @@ -268,12 +270,10 @@ public function getTypeAllowableValues() * * @return string[] */ - public function getLawfulBasisAllowableValues() + public function getTypeAllowableValues() { return [ - self::LAWFUL_BASIS_LEAD, - self::LAWFUL_BASIS_CLIENT, - self::LAWFUL_BASIS_OTHER, + self::TYPE_LEGITIMATE_INTEREST, ]; } @@ -287,14 +287,14 @@ public function getLawfulBasisAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('type', $data ?? [], 'legitimate_interest'); $this->setIfExists('subscription_type_ids', $data ?? [], null); $this->setIfExists('lawful_basis', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'legitimate_interest'); $this->setIfExists('privacy_text', $data ?? [], null); } @@ -325,18 +325,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'type', must be one of '%s'", - $this->container['type'], - implode("', '", $allowedValues) - ); - } - if ($this->container['subscription_type_ids'] === null) { $invalidProperties[] = "'subscription_type_ids' can't be null"; } @@ -352,6 +340,18 @@ public function listInvalidProperties() ); } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + if ($this->container['privacy_text'] === null) { $invalidProperties[] = "'privacy_text' can't be null"; } @@ -370,43 +370,6 @@ public function valid() } - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type type - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'type', must be one of '%s'", - $type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['type'] = $type; - - return $this; - } - /** * Gets subscription_type_ids * @@ -420,7 +383,7 @@ public function getSubscriptionTypeIds() /** * Sets subscription_type_ids * - * @param int[] $subscription_type_ids subscription_type_ids + * @param int[] $subscription_type_ids * * @return self */ @@ -447,7 +410,7 @@ public function getLawfulBasis() /** * Sets lawful_basis * - * @param string $lawful_basis lawful_basis + * @param string $lawful_basis * * @return self */ @@ -471,6 +434,43 @@ public function setLawfulBasis($lawful_basis) return $this; } + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + /** * Gets privacy_text * @@ -484,7 +484,7 @@ public function getPrivacyText() /** * Sets privacy_text * - * @param string $privacy_text privacy_text + * @param string $privacy_text * * @return self */ diff --git a/codegen/Marketing/Forms/Model/LegalConsentOptionsNone.php b/codegen/Marketing/Forms/Model/LegalConsentOptionsNone.php index f05ce840e..1cdf4dd96 100644 --- a/codegen/Marketing/Forms/Model/LegalConsentOptionsNone.php +++ b/codegen/Marketing/Forms/Model/LegalConsentOptionsNone.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('type', $data ?? [], 'none'); } @@ -327,7 +327,7 @@ public function getType() /** * Sets type * - * @param string $type type + * @param string $type * * @return self */ diff --git a/codegen/Marketing/Forms/Model/LifecycleStage.php b/codegen/Marketing/Forms/Model/LifecycleStage.php index 5ebb98f1f..2c951e32c 100644 --- a/codegen/Marketing/Forms/Model/LifecycleStage.php +++ b/codegen/Marketing/Forms/Model/LifecycleStage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_type_id', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/MobilePhoneField.php b/codegen/Marketing/Forms/Model/MobilePhoneField.php index 18593eeb9..def582d3b 100644 --- a/codegen/Marketing/Forms/Model/MobilePhoneField.php +++ b/codegen/Marketing/Forms/Model/MobilePhoneField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,16 +58,16 @@ class MobilePhoneField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string', + 'field_type' => 'string', + 'required' => 'bool', 'validation' => '\HubSpot\Client\Marketing\Forms\Model\PhoneFieldValidation' ]; @@ -79,16 +79,16 @@ class MobilePhoneField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null, + 'field_type' => null, + 'required' => null, 'validation' => null ]; @@ -98,16 +98,16 @@ class MobilePhoneField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false, + 'field_type' => false, + 'required' => false, 'validation' => false ]; @@ -197,16 +197,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue', + 'field_type' => 'fieldType', + 'required' => 'required', 'validation' => 'validation' ]; @@ -216,16 +216,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue', + 'field_type' => 'setFieldType', + 'required' => 'setRequired', 'validation' => 'setValidation' ]; @@ -235,16 +235,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue', + 'field_type' => 'getFieldType', + 'required' => 'getRequired', 'validation' => 'getValidation' ]; @@ -313,21 +313,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'mobile_phone'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'mobile_phone'); + $this->setIfExists('required', $data ?? [], null); $this->setIfExists('validation', $data ?? [], null); } @@ -358,6 +358,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -370,24 +385,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } if ($this->container['validation'] === null) { $invalidProperties[] = "'validation' can't be null"; } @@ -407,119 +407,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label The main label for the form field. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -552,136 +542,146 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string $label The main label for the form field. * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets placeholder * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string|null */ - public function getDependentFields() + public function getPlaceholder() { - return $this->container['dependent_fields']; + return $this->container['placeholder']; } /** - * Sets dependent_fields + * Sets placeholder * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDependentFields($dependent_fields) + public function setPlaceholder($placeholder) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets placeholder + * Gets field_type * - * @return string|null + * @return string */ - public function getPlaceholder() + public function getFieldType() { - return $this->container['placeholder']; + return $this->container['field_type']; } /** - * Sets placeholder + * Sets field_type * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setPlaceholder($placeholder) + public function setFieldType($field_type) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['placeholder'] = $placeholder; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/ModelInterface.php b/codegen/Marketing/Forms/Model/ModelInterface.php index 8d790308a..7c54c74d9 100644 --- a/codegen/Marketing/Forms/Model/ModelInterface.php +++ b/codegen/Marketing/Forms/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Marketing/Forms/Model/MultiLineTextField.php b/codegen/Marketing/Forms/Model/MultiLineTextField.php index 2e4ee9e9e..92d120197 100644 --- a/codegen/Marketing/Forms/Model/MultiLineTextField.php +++ b/codegen/Marketing/Forms/Model/MultiLineTextField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,16 +58,16 @@ class MultiLineTextField implements ModelInterface, ArrayAccess, \JsonSerializab * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string' + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -78,16 +78,16 @@ class MultiLineTextField implements ModelInterface, ArrayAccess, \JsonSerializab * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null + 'field_type' => null, + 'required' => null ]; /** @@ -96,16 +96,16 @@ class MultiLineTextField implements ModelInterface, ArrayAccess, \JsonSerializab * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false + 'field_type' => false, + 'required' => false ]; /** @@ -194,16 +194,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue' + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -212,16 +212,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue' + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -230,16 +230,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue' + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -307,21 +307,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'multi_line_text'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'multi_line_text'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -351,6 +351,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -363,24 +378,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } return $invalidProperties; } @@ -397,119 +397,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label The main label for the form field. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -542,136 +532,146 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string $label The main label for the form field. * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets placeholder * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string|null */ - public function getDependentFields() + public function getPlaceholder() { - return $this->container['dependent_fields']; + return $this->container['placeholder']; } /** - * Sets dependent_fields + * Sets placeholder * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDependentFields($dependent_fields) + public function setPlaceholder($placeholder) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets placeholder + * Gets field_type * - * @return string|null + * @return string */ - public function getPlaceholder() + public function getFieldType() { - return $this->container['placeholder']; + return $this->container['field_type']; } /** - * Sets placeholder + * Sets field_type * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setPlaceholder($placeholder) + public function setFieldType($field_type) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['placeholder'] = $placeholder; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/MultipleCheckboxesField.php b/codegen/Marketing/Forms/Model/MultipleCheckboxesField.php index b8e4efb03..19bd83c9e 100644 --- a/codegen/Marketing/Forms/Model/MultipleCheckboxesField.php +++ b/codegen/Marketing/Forms/Model/MultipleCheckboxesField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,16 +58,16 @@ class MultipleCheckboxesField implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', 'name' => 'string', - 'label' => 'string', + 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', - 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', 'default_values' => 'string[]', - 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]' + 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -78,16 +78,16 @@ class MultipleCheckboxesField implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, 'name' => null, - 'label' => null, + 'options' => null, 'description' => null, - 'required' => null, - 'hidden' => null, - 'dependent_fields' => null, 'default_values' => null, - 'options' => null + 'dependent_fields' => null, + 'label' => null, + 'field_type' => null, + 'required' => null ]; /** @@ -96,16 +96,16 @@ class MultipleCheckboxesField implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, 'name' => false, - 'label' => false, + 'options' => false, 'description' => false, - 'required' => false, - 'hidden' => false, - 'dependent_fields' => false, 'default_values' => false, - 'options' => false + 'dependent_fields' => false, + 'label' => false, + 'field_type' => false, + 'required' => false ]; /** @@ -194,16 +194,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', 'name' => 'name', - 'label' => 'label', + 'options' => 'options', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', - 'dependent_fields' => 'dependentFields', 'default_values' => 'defaultValues', - 'options' => 'options' + 'dependent_fields' => 'dependentFields', + 'label' => 'label', + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -212,16 +212,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', 'name' => 'setName', - 'label' => 'setLabel', + 'options' => 'setOptions', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', - 'dependent_fields' => 'setDependentFields', 'default_values' => 'setDefaultValues', - 'options' => 'setOptions' + 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -230,16 +230,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', 'name' => 'getName', - 'label' => 'getLabel', + 'options' => 'getOptions', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', - 'dependent_fields' => 'getDependentFields', 'default_values' => 'getDefaultValues', - 'options' => 'getOptions' + 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -307,21 +307,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'multiple_checkboxes'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('dependent_fields', $data ?? [], null); $this->setIfExists('default_values', $data ?? [], null); - $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'multiple_checkboxes'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -351,6 +351,27 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['options'] === null) { + $invalidProperties[] = "'options' can't be null"; + } + if ($this->container['default_values'] === null) { + $invalidProperties[] = "'default_values' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -363,30 +384,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } - if ($this->container['default_values'] === null) { - $invalidProperties[] = "'default_values' can't be null"; - } - if ($this->container['options'] === null) { - $invalidProperties[] = "'options' can't be null"; - } return $invalidProperties; } @@ -403,65 +403,55 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } @@ -494,28 +484,28 @@ public function setName($name) } /** - * Gets label + * Gets options * - * @return string + * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] */ - public function getLabel() + public function getOptions() { - return $this->container['label']; + return $this->container['options']; } /** - * Sets label + * Sets options * - * @param string $label The main label for the form field. + * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options The list of available choices for this field. * * @return self */ - public function setLabel($label) + public function setOptions($options) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); } - $this->container['label'] = $label; + $this->container['options'] = $options; return $this; } @@ -548,136 +538,146 @@ public function setDescription($description) } /** - * Gets required + * Gets default_values * - * @return bool + * @return string[] */ - public function getRequired() + public function getDefaultValues() { - return $this->container['required']; + return $this->container['default_values']; } /** - * Sets required + * Sets default_values * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param string[] $default_values The values selected by default. Those values will be submitted unless the customer modifies them. * * @return self */ - public function setRequired($required) + public function setDefaultValues($default_values) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($default_values)) { + throw new \InvalidArgumentException('non-nullable default_values cannot be null'); } - $this->container['required'] = $required; + $this->container['default_values'] = $default_values; return $this; } /** - * Gets hidden + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getHidden() + public function getDependentFields() { - return $this->container['hidden']; + return $this->container['dependent_fields']; } /** - * Sets hidden + * Sets dependent_fields * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setHidden($hidden) + public function setDependentFields($dependent_fields) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets dependent_fields + * Gets label * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string */ - public function getDependentFields() + public function getLabel() { - return $this->container['dependent_fields']; + return $this->container['label']; } /** - * Sets dependent_fields + * Sets label * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string $label The main label for the form field. * * @return self */ - public function setDependentFields($dependent_fields) + public function setLabel($label) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['label'] = $label; return $this; } /** - * Gets default_values + * Gets field_type * - * @return string[] + * @return string */ - public function getDefaultValues() + public function getFieldType() { - return $this->container['default_values']; + return $this->container['field_type']; } /** - * Sets default_values + * Sets field_type * - * @param string[] $default_values The values selected by default. Those values will be submitted unless the customer modifies them. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setDefaultValues($default_values) + public function setFieldType($field_type) { - if (is_null($default_values)) { - throw new \InvalidArgumentException('non-nullable default_values cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['default_values'] = $default_values; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets options + * Gets required * - * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] + * @return bool */ - public function getOptions() + public function getRequired() { - return $this->container['options']; + return $this->container['required']; } /** - * Sets options + * Sets required * - * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options The list of available choices for this field. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setOptions($options) + public function setRequired($required) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['options'] = $options; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/NextPage.php b/codegen/Marketing/Forms/Model/NextPage.php index 4f28556ad..ff3345ce6 100644 --- a/codegen/Marketing/Forms/Model/NextPage.php +++ b/codegen/Marketing/Forms/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Marketing/Forms/Model/NumberField.php b/codegen/Marketing/Forms/Model/NumberField.php index 447e93bf2..568ccf21d 100644 --- a/codegen/Marketing/Forms/Model/NumberField.php +++ b/codegen/Marketing/Forms/Model/NumberField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,16 +58,16 @@ class NumberField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string', + 'field_type' => 'string', + 'required' => 'bool', 'validation' => '\HubSpot\Client\Marketing\Forms\Model\NumberFieldValidation' ]; @@ -79,16 +79,16 @@ class NumberField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null, + 'field_type' => null, + 'required' => null, 'validation' => null ]; @@ -98,16 +98,16 @@ class NumberField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false, + 'field_type' => false, + 'required' => false, 'validation' => false ]; @@ -197,16 +197,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue', + 'field_type' => 'fieldType', + 'required' => 'required', 'validation' => 'validation' ]; @@ -216,16 +216,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue', + 'field_type' => 'setFieldType', + 'required' => 'setRequired', 'validation' => 'setValidation' ]; @@ -235,16 +235,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue', + 'field_type' => 'getFieldType', + 'required' => 'getRequired', 'validation' => 'getValidation' ]; @@ -313,21 +313,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'number'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'number'); + $this->setIfExists('required', $data ?? [], null); $this->setIfExists('validation', $data ?? [], null); } @@ -358,6 +358,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -370,24 +385,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } return $invalidProperties; } @@ -404,119 +404,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label The main label for the form field. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -549,136 +539,146 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string $label The main label for the form field. * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets placeholder * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string|null */ - public function getDependentFields() + public function getPlaceholder() { - return $this->container['dependent_fields']; + return $this->container['placeholder']; } /** - * Sets dependent_fields + * Sets placeholder * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDependentFields($dependent_fields) + public function setPlaceholder($placeholder) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets placeholder + * Gets field_type * - * @return string|null + * @return string */ - public function getPlaceholder() + public function getFieldType() { - return $this->container['placeholder']; + return $this->container['field_type']; } /** - * Sets placeholder + * Sets field_type * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setPlaceholder($placeholder) + public function setFieldType($field_type) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['placeholder'] = $placeholder; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/NumberFieldValidation.php b/codegen/Marketing/Forms/Model/NumberFieldValidation.php index 4c0a98e6f..842a1f46e 100644 --- a/codegen/Marketing/Forms/Model/NumberFieldValidation.php +++ b/codegen/Marketing/Forms/Model/NumberFieldValidation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('min_allowed_digits', $data ?? [], null); $this->setIfExists('max_allowed_digits', $data ?? [], null); @@ -316,7 +316,7 @@ public function getMinAllowedDigits() /** * Sets min_allowed_digits * - * @param int $min_allowed_digits min_allowed_digits + * @param int $min_allowed_digits * * @return self */ @@ -343,7 +343,7 @@ public function getMaxAllowedDigits() /** * Sets max_allowed_digits * - * @param int $max_allowed_digits max_allowed_digits + * @param int $max_allowed_digits * * @return self */ diff --git a/codegen/Marketing/Forms/Model/PaymentLinkRadioField.php b/codegen/Marketing/Forms/Model/PaymentLinkRadioField.php index c6d4bd5a5..7aae3b06a 100644 --- a/codegen/Marketing/Forms/Model/PaymentLinkRadioField.php +++ b/codegen/Marketing/Forms/Model/PaymentLinkRadioField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,16 +57,16 @@ class PaymentLinkRadioField implements ModelInterface, ArrayAccess, \JsonSeriali * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', 'name' => 'string', - 'label' => 'string', + 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', - 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', 'default_values' => 'string[]', - 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]' + 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -77,16 +77,16 @@ class PaymentLinkRadioField implements ModelInterface, ArrayAccess, \JsonSeriali * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, 'name' => null, - 'label' => null, + 'options' => null, 'description' => null, - 'required' => null, - 'hidden' => null, - 'dependent_fields' => null, 'default_values' => null, - 'options' => null + 'dependent_fields' => null, + 'label' => null, + 'field_type' => null, + 'required' => null ]; /** @@ -95,16 +95,16 @@ class PaymentLinkRadioField implements ModelInterface, ArrayAccess, \JsonSeriali * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, 'name' => false, - 'label' => false, + 'options' => false, 'description' => false, - 'required' => false, - 'hidden' => false, - 'dependent_fields' => false, 'default_values' => false, - 'options' => false + 'dependent_fields' => false, + 'label' => false, + 'field_type' => false, + 'required' => false ]; /** @@ -193,16 +193,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', 'name' => 'name', - 'label' => 'label', + 'options' => 'options', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', - 'dependent_fields' => 'dependentFields', 'default_values' => 'defaultValues', - 'options' => 'options' + 'dependent_fields' => 'dependentFields', + 'label' => 'label', + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -211,16 +211,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', 'name' => 'setName', - 'label' => 'setLabel', + 'options' => 'setOptions', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', - 'dependent_fields' => 'setDependentFields', 'default_values' => 'setDefaultValues', - 'options' => 'setOptions' + 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -229,16 +229,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', 'name' => 'getName', - 'label' => 'getLabel', + 'options' => 'getOptions', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', - 'dependent_fields' => 'getDependentFields', 'default_values' => 'getDefaultValues', - 'options' => 'getOptions' + 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -306,21 +306,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'payment_link_radio'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('dependent_fields', $data ?? [], null); $this->setIfExists('default_values', $data ?? [], null); - $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'payment_link_radio'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -350,6 +350,27 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['options'] === null) { + $invalidProperties[] = "'options' can't be null"; + } + if ($this->container['default_values'] === null) { + $invalidProperties[] = "'default_values' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -362,30 +383,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } - if ($this->container['default_values'] === null) { - $invalidProperties[] = "'default_values' can't be null"; - } - if ($this->container['options'] === null) { - $invalidProperties[] = "'options' can't be null"; - } return $invalidProperties; } @@ -402,65 +402,55 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type field_type + * @param string $object_type_id object_type_id * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id object_type_id + * @param bool $hidden hidden * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } @@ -493,28 +483,28 @@ public function setName($name) } /** - * Gets label + * Gets options * - * @return string + * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] */ - public function getLabel() + public function getOptions() { - return $this->container['label']; + return $this->container['options']; } /** - * Sets label + * Sets options * - * @param string $label label + * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options options * * @return self */ - public function setLabel($label) + public function setOptions($options) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); } - $this->container['label'] = $label; + $this->container['options'] = $options; return $this; } @@ -547,136 +537,146 @@ public function setDescription($description) } /** - * Gets required + * Gets default_values * - * @return bool + * @return string[] */ - public function getRequired() + public function getDefaultValues() { - return $this->container['required']; + return $this->container['default_values']; } /** - * Sets required + * Sets default_values * - * @param bool $required required + * @param string[] $default_values default_values * * @return self */ - public function setRequired($required) + public function setDefaultValues($default_values) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($default_values)) { + throw new \InvalidArgumentException('non-nullable default_values cannot be null'); } - $this->container['required'] = $required; + $this->container['default_values'] = $default_values; return $this; } /** - * Gets hidden + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getHidden() + public function getDependentFields() { - return $this->container['hidden']; + return $this->container['dependent_fields']; } /** - * Sets hidden + * Sets dependent_fields * - * @param bool $hidden hidden + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields dependent_fields * * @return self */ - public function setHidden($hidden) + public function setDependentFields($dependent_fields) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets dependent_fields + * Gets label * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string */ - public function getDependentFields() + public function getLabel() { - return $this->container['dependent_fields']; + return $this->container['label']; } /** - * Sets dependent_fields + * Sets label * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields dependent_fields + * @param string $label label * * @return self */ - public function setDependentFields($dependent_fields) + public function setLabel($label) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['label'] = $label; return $this; } /** - * Gets default_values + * Gets field_type * - * @return string[] + * @return string */ - public function getDefaultValues() + public function getFieldType() { - return $this->container['default_values']; + return $this->container['field_type']; } /** - * Sets default_values + * Sets field_type * - * @param string[] $default_values default_values + * @param string $field_type field_type * * @return self */ - public function setDefaultValues($default_values) + public function setFieldType($field_type) { - if (is_null($default_values)) { - throw new \InvalidArgumentException('non-nullable default_values cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['default_values'] = $default_values; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets options + * Gets required * - * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] + * @return bool */ - public function getOptions() + public function getRequired() { - return $this->container['options']; + return $this->container['required']; } /** - * Sets options + * Sets required * - * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options options + * @param bool $required required * * @return self */ - public function setOptions($options) + public function setRequired($required) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['options'] = $options; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/PhoneField.php b/codegen/Marketing/Forms/Model/PhoneField.php index 704d86dcf..9be9a24f0 100644 --- a/codegen/Marketing/Forms/Model/PhoneField.php +++ b/codegen/Marketing/Forms/Model/PhoneField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,17 +58,17 @@ class PhoneField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', + 'use_country_code_select' => 'bool', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string', - 'use_country_code_select' => 'bool', + 'field_type' => 'string', + 'required' => 'bool', 'validation' => '\HubSpot\Client\Marketing\Forms\Model\PhoneFieldValidation' ]; @@ -80,17 +80,17 @@ class PhoneField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, + 'use_country_code_select' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null, - 'use_country_code_select' => null, + 'field_type' => null, + 'required' => null, 'validation' => null ]; @@ -100,17 +100,17 @@ class PhoneField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, + 'use_country_code_select' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false, - 'use_country_code_select' => false, + 'field_type' => false, + 'required' => false, 'validation' => false ]; @@ -200,17 +200,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', + 'use_country_code_select' => 'useCountryCodeSelect', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue', - 'use_country_code_select' => 'useCountryCodeSelect', + 'field_type' => 'fieldType', + 'required' => 'required', 'validation' => 'validation' ]; @@ -220,17 +220,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', + 'use_country_code_select' => 'setUseCountryCodeSelect', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue', - 'use_country_code_select' => 'setUseCountryCodeSelect', + 'field_type' => 'setFieldType', + 'required' => 'setRequired', 'validation' => 'setValidation' ]; @@ -240,17 +240,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', + 'use_country_code_select' => 'getUseCountryCodeSelect', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue', - 'use_country_code_select' => 'getUseCountryCodeSelect', + 'field_type' => 'getFieldType', + 'required' => 'getRequired', 'validation' => 'getValidation' ]; @@ -319,22 +319,22 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'phone'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('use_country_code_select', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); - $this->setIfExists('use_country_code_select', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'phone'); + $this->setIfExists('required', $data ?? [], null); $this->setIfExists('validation', $data ?? [], null); } @@ -365,6 +365,24 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['use_country_code_select'] === null) { + $invalidProperties[] = "'use_country_code_select' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -377,27 +395,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } - if ($this->container['use_country_code_select'] === null) { - $invalidProperties[] = "'use_country_code_select' can't be null"; - } if ($this->container['validation'] === null) { $invalidProperties[] = "'validation' can't be null"; } @@ -416,43 +416,6 @@ public function valid() } - /** - * Gets field_type - * - * @return string - */ - public function getFieldType() - { - return $this->container['field_type']; - } - - /** - * Sets field_type - * - * @param string $field_type Determines how the field will be displayed and validated. - * - * @return self - */ - public function setFieldType($field_type) - { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); - } - $this->container['field_type'] = $field_type; - - return $this; - } - /** * Gets object_type_id * @@ -481,136 +444,136 @@ public function setObjectTypeId($object_type_id) } /** - * Gets name + * Gets hidden * - * @return string + * @return bool */ - public function getName() + public function getHidden() { - return $this->container['name']; + return $this->container['hidden']; } /** - * Sets name + * Sets hidden * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setName($name) + public function setHidden($hidden) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['name'] = $name; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets label + * Gets default_value * - * @return string + * @return string|null */ - public function getLabel() + public function getDefaultValue() { - return $this->container['label']; + return $this->container['default_value']; } /** - * Sets label + * Sets default_value * - * @param string $label The main label for the form field. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setLabel($label) + public function setDefaultValue($default_value) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['label'] = $label; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets description + * Gets use_country_code_select * - * @return string|null + * @return bool */ - public function getDescription() + public function getUseCountryCodeSelect() { - return $this->container['description']; + return $this->container['use_country_code_select']; } /** - * Sets description + * Sets use_country_code_select * - * @param string|null $description Additional text helping the customer to complete the field. + * @param bool $use_country_code_select Whether to display a country code drop down next to the phone field. * * @return self */ - public function setDescription($description) + public function setUseCountryCodeSelect($use_country_code_select) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($use_country_code_select)) { + throw new \InvalidArgumentException('non-nullable use_country_code_select cannot be null'); } - $this->container['description'] = $description; + $this->container['use_country_code_select'] = $use_country_code_select; return $this; } /** - * Gets required + * Gets name * - * @return bool + * @return string */ - public function getRequired() + public function getName() { - return $this->container['required']; + return $this->container['name']; } /** - * Sets required + * Sets name * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setRequired($required) + public function setName($name) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['required'] = $required; + $this->container['name'] = $name; return $this; } /** - * Gets hidden + * Gets description * - * @return bool + * @return string|null */ - public function getHidden() + public function getDescription() { - return $this->container['hidden']; + return $this->container['description']; } /** - * Sets hidden + * Sets description * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string|null $description Additional text helping the customer to complete the field. * * @return self */ - public function setHidden($hidden) + public function setDescription($description) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['description'] = $description; return $this; } @@ -642,6 +605,33 @@ public function setDependentFields($dependent_fields) return $this; } + /** + * Gets label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label The main label for the form field. + * + * @return self + */ + public function setLabel($label) + { + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); + } + $this->container['label'] = $label; + + return $this; + } + /** * Gets placeholder * @@ -670,55 +660,65 @@ public function setPlaceholder($placeholder) } /** - * Gets default_value + * Gets field_type * - * @return string|null + * @return string */ - public function getDefaultValue() + public function getFieldType() { - return $this->container['default_value']; + return $this->container['field_type']; } /** - * Sets default_value + * Sets field_type * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setDefaultValue($default_value) + public function setFieldType($field_type) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['default_value'] = $default_value; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets use_country_code_select + * Gets required * * @return bool */ - public function getUseCountryCodeSelect() + public function getRequired() { - return $this->container['use_country_code_select']; + return $this->container['required']; } /** - * Sets use_country_code_select + * Sets required * - * @param bool $use_country_code_select Whether to display a country code drop down next to the phone field. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setUseCountryCodeSelect($use_country_code_select) + public function setRequired($required) { - if (is_null($use_country_code_select)) { - throw new \InvalidArgumentException('non-nullable use_country_code_select cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['use_country_code_select'] = $use_country_code_select; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/PhoneFieldValidation.php b/codegen/Marketing/Forms/Model/PhoneFieldValidation.php index 29ea45631..576336ee4 100644 --- a/codegen/Marketing/Forms/Model/PhoneFieldValidation.php +++ b/codegen/Marketing/Forms/Model/PhoneFieldValidation.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('min_allowed_digits', $data ?? [], null); $this->setIfExists('max_allowed_digits', $data ?? [], null); @@ -316,7 +316,7 @@ public function getMinAllowedDigits() /** * Sets min_allowed_digits * - * @param int $min_allowed_digits min_allowed_digits + * @param int $min_allowed_digits * * @return self */ @@ -343,7 +343,7 @@ public function getMaxAllowedDigits() /** * Sets max_allowed_digits * - * @param int $max_allowed_digits max_allowed_digits + * @param int $max_allowed_digits * * @return self */ diff --git a/codegen/Marketing/Forms/Model/RadioField.php b/codegen/Marketing/Forms/Model/RadioField.php index 7eafcb1f0..4d58bb478 100644 --- a/codegen/Marketing/Forms/Model/RadioField.php +++ b/codegen/Marketing/Forms/Model/RadioField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,17 +58,17 @@ class RadioField implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', 'name' => 'string', - 'label' => 'string', + 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', - 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', 'default_values' => 'string[]', - 'options' => '\HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[]', - 'placeholder' => 'string' + 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', + 'placeholder' => 'string', + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -79,17 +79,17 @@ class RadioField implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, 'name' => null, - 'label' => null, + 'options' => null, 'description' => null, - 'required' => null, - 'hidden' => null, - 'dependent_fields' => null, 'default_values' => null, - 'options' => null, - 'placeholder' => null + 'dependent_fields' => null, + 'label' => null, + 'placeholder' => null, + 'field_type' => null, + 'required' => null ]; /** @@ -98,17 +98,17 @@ class RadioField implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, 'name' => false, - 'label' => false, + 'options' => false, 'description' => false, - 'required' => false, - 'hidden' => false, - 'dependent_fields' => false, 'default_values' => false, - 'options' => false, - 'placeholder' => false + 'dependent_fields' => false, + 'label' => false, + 'placeholder' => false, + 'field_type' => false, + 'required' => false ]; /** @@ -197,17 +197,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', 'name' => 'name', - 'label' => 'label', + 'options' => 'options', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', - 'dependent_fields' => 'dependentFields', 'default_values' => 'defaultValues', - 'options' => 'options', - 'placeholder' => 'placeholder' + 'dependent_fields' => 'dependentFields', + 'label' => 'label', + 'placeholder' => 'placeholder', + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -216,17 +216,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', 'name' => 'setName', - 'label' => 'setLabel', + 'options' => 'setOptions', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', - 'dependent_fields' => 'setDependentFields', 'default_values' => 'setDefaultValues', - 'options' => 'setOptions', - 'placeholder' => 'setPlaceholder' + 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', + 'placeholder' => 'setPlaceholder', + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -235,17 +235,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', 'name' => 'getName', - 'label' => 'getLabel', + 'options' => 'getOptions', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', - 'dependent_fields' => 'getDependentFields', 'default_values' => 'getDefaultValues', - 'options' => 'getOptions', - 'placeholder' => 'getPlaceholder' + 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', + 'placeholder' => 'getPlaceholder', + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -313,22 +313,22 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'radio'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('dependent_fields', $data ?? [], null); $this->setIfExists('default_values', $data ?? [], null); - $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'radio'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -358,6 +358,27 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['options'] === null) { + $invalidProperties[] = "'options' can't be null"; + } + if ($this->container['default_values'] === null) { + $invalidProperties[] = "'default_values' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -370,30 +391,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } - if ($this->container['default_values'] === null) { - $invalidProperties[] = "'default_values' can't be null"; - } - if ($this->container['options'] === null) { - $invalidProperties[] = "'options' can't be null"; - } return $invalidProperties; } @@ -410,65 +410,55 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } @@ -501,28 +491,28 @@ public function setName($name) } /** - * Gets label + * Gets options * - * @return string + * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] */ - public function getLabel() + public function getOptions() { - return $this->container['label']; + return $this->container['options']; } /** - * Sets label + * Sets options * - * @param string $label The main label for the form field. + * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options The list of available choices for this field. * * @return self */ - public function setLabel($label) + public function setOptions($options) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); } - $this->container['label'] = $label; + $this->container['options'] = $options; return $this; } @@ -555,163 +545,173 @@ public function setDescription($description) } /** - * Gets required + * Gets default_values * - * @return bool + * @return string[] */ - public function getRequired() + public function getDefaultValues() { - return $this->container['required']; + return $this->container['default_values']; } /** - * Sets required + * Sets default_values * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param string[] $default_values The values selected by default. Those values will be submitted unless the customer modifies them. * * @return self */ - public function setRequired($required) + public function setDefaultValues($default_values) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($default_values)) { + throw new \InvalidArgumentException('non-nullable default_values cannot be null'); } - $this->container['required'] = $required; + $this->container['default_values'] = $default_values; return $this; } /** - * Gets hidden + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getHidden() + public function getDependentFields() { - return $this->container['hidden']; + return $this->container['dependent_fields']; } /** - * Sets hidden + * Sets dependent_fields * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setHidden($hidden) + public function setDependentFields($dependent_fields) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets dependent_fields + * Gets label * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string */ - public function getDependentFields() + public function getLabel() { - return $this->container['dependent_fields']; + return $this->container['label']; } /** - * Sets dependent_fields + * Sets label * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string $label The main label for the form field. * * @return self */ - public function setDependentFields($dependent_fields) + public function setLabel($label) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['label'] = $label; return $this; } /** - * Gets default_values + * Gets placeholder * - * @return string[] + * @return string|null */ - public function getDefaultValues() + public function getPlaceholder() { - return $this->container['default_values']; + return $this->container['placeholder']; } /** - * Sets default_values + * Sets placeholder * - * @param string[] $default_values The values selected by default. Those values will be submitted unless the customer modifies them. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDefaultValues($default_values) + public function setPlaceholder($placeholder) { - if (is_null($default_values)) { - throw new \InvalidArgumentException('non-nullable default_values cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['default_values'] = $default_values; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets options + * Gets field_type * - * @return \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] + * @return string */ - public function getOptions() + public function getFieldType() { - return $this->container['options']; + return $this->container['field_type']; } /** - * Sets options + * Sets field_type * - * @param \HubSpot\Client\Marketing\Forms\Model\EnumeratedFieldOption[] $options The list of available choices for this field. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setOptions($options) + public function setFieldType($field_type) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['options'] = $options; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets placeholder + * Gets required * - * @return string|null + * @return bool */ - public function getPlaceholder() + public function getRequired() { - return $this->container['placeholder']; + return $this->container['required']; } /** - * Sets placeholder + * Sets required * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setPlaceholder($placeholder) + public function setRequired($required) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['placeholder'] = $placeholder; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/SingleCheckboxField.php b/codegen/Marketing/Forms/Model/SingleCheckboxField.php index 78b64ac39..3d34d14e5 100644 --- a/codegen/Marketing/Forms/Model/SingleCheckboxField.php +++ b/codegen/Marketing/Forms/Model/SingleCheckboxField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,15 +58,15 @@ class SingleCheckboxField implements ModelInterface, ArrayAccess, \JsonSerializa * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', - 'default_value' => 'string' + 'label' => 'string', + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -77,15 +77,15 @@ class SingleCheckboxField implements ModelInterface, ArrayAccess, \JsonSerializa * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, - 'default_value' => null + 'label' => null, + 'field_type' => null, + 'required' => null ]; /** @@ -94,15 +94,15 @@ class SingleCheckboxField implements ModelInterface, ArrayAccess, \JsonSerializa * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, - 'default_value' => false + 'label' => false, + 'field_type' => false, + 'required' => false ]; /** @@ -191,15 +191,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', - 'default_value' => 'defaultValue' + 'label' => 'label', + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -208,15 +208,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', - 'default_value' => 'setDefaultValue' + 'label' => 'setLabel', + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -225,15 +225,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', - 'default_value' => 'getDefaultValue' + 'label' => 'getLabel', + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -301,20 +301,20 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'single_checkbox'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'single_checkbox'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -344,6 +344,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -356,24 +371,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } return $invalidProperties; } @@ -390,119 +390,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label The main label for the form field. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -535,109 +525,119 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string $label The main label for the form field. * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets field_type * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string */ - public function getDependentFields() + public function getFieldType() { - return $this->container['dependent_fields']; + return $this->container['field_type']; } /** - * Sets dependent_fields + * Sets field_type * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setDependentFields($dependent_fields) + public function setFieldType($field_type) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/Model/SingleLineTextField.php b/codegen/Marketing/Forms/Model/SingleLineTextField.php index 5561023ee..fd9492d69 100644 --- a/codegen/Marketing/Forms/Model/SingleLineTextField.php +++ b/codegen/Marketing/Forms/Model/SingleLineTextField.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,16 +58,16 @@ class SingleLineTextField implements ModelInterface, ArrayAccess, \JsonSerializa * @var string[] */ protected static $openAPITypes = [ - 'field_type' => 'string', 'object_type_id' => 'string', + 'hidden' => 'bool', + 'default_value' => 'string', 'name' => 'string', - 'label' => 'string', 'description' => 'string', - 'required' => 'bool', - 'hidden' => 'bool', 'dependent_fields' => '\HubSpot\Client\Marketing\Forms\Model\DependentField[]', + 'label' => 'string', 'placeholder' => 'string', - 'default_value' => 'string' + 'field_type' => 'string', + 'required' => 'bool' ]; /** @@ -78,16 +78,16 @@ class SingleLineTextField implements ModelInterface, ArrayAccess, \JsonSerializa * @psalm-var array */ protected static $openAPIFormats = [ - 'field_type' => null, 'object_type_id' => null, + 'hidden' => null, + 'default_value' => null, 'name' => null, - 'label' => null, 'description' => null, - 'required' => null, - 'hidden' => null, 'dependent_fields' => null, + 'label' => null, 'placeholder' => null, - 'default_value' => null + 'field_type' => null, + 'required' => null ]; /** @@ -96,16 +96,16 @@ class SingleLineTextField implements ModelInterface, ArrayAccess, \JsonSerializa * @var boolean[] */ protected static array $openAPINullables = [ - 'field_type' => false, 'object_type_id' => false, + 'hidden' => false, + 'default_value' => false, 'name' => false, - 'label' => false, 'description' => false, - 'required' => false, - 'hidden' => false, 'dependent_fields' => false, + 'label' => false, 'placeholder' => false, - 'default_value' => false + 'field_type' => false, + 'required' => false ]; /** @@ -194,16 +194,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'field_type' => 'fieldType', 'object_type_id' => 'objectTypeId', + 'hidden' => 'hidden', + 'default_value' => 'defaultValue', 'name' => 'name', - 'label' => 'label', 'description' => 'description', - 'required' => 'required', - 'hidden' => 'hidden', 'dependent_fields' => 'dependentFields', + 'label' => 'label', 'placeholder' => 'placeholder', - 'default_value' => 'defaultValue' + 'field_type' => 'fieldType', + 'required' => 'required' ]; /** @@ -212,16 +212,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'field_type' => 'setFieldType', 'object_type_id' => 'setObjectTypeId', + 'hidden' => 'setHidden', + 'default_value' => 'setDefaultValue', 'name' => 'setName', - 'label' => 'setLabel', 'description' => 'setDescription', - 'required' => 'setRequired', - 'hidden' => 'setHidden', 'dependent_fields' => 'setDependentFields', + 'label' => 'setLabel', 'placeholder' => 'setPlaceholder', - 'default_value' => 'setDefaultValue' + 'field_type' => 'setFieldType', + 'required' => 'setRequired' ]; /** @@ -230,16 +230,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'field_type' => 'getFieldType', 'object_type_id' => 'getObjectTypeId', + 'hidden' => 'getHidden', + 'default_value' => 'getDefaultValue', 'name' => 'getName', - 'label' => 'getLabel', 'description' => 'getDescription', - 'required' => 'getRequired', - 'hidden' => 'getHidden', 'dependent_fields' => 'getDependentFields', + 'label' => 'getLabel', 'placeholder' => 'getPlaceholder', - 'default_value' => 'getDefaultValue' + 'field_type' => 'getFieldType', + 'required' => 'getRequired' ]; /** @@ -307,21 +307,21 @@ public function getFieldTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('field_type', $data ?? [], 'single_line_text'); $this->setIfExists('object_type_id', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('default_value', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('required', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('dependent_fields', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('placeholder', $data ?? [], null); - $this->setIfExists('default_value', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], 'single_line_text'); + $this->setIfExists('required', $data ?? [], null); } /** @@ -351,6 +351,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['object_type_id'] === null) { + $invalidProperties[] = "'object_type_id' can't be null"; + } + if ($this->container['hidden'] === null) { + $invalidProperties[] = "'hidden' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['dependent_fields'] === null) { + $invalidProperties[] = "'dependent_fields' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['field_type'] === null) { $invalidProperties[] = "'field_type' can't be null"; } @@ -363,24 +378,9 @@ public function listInvalidProperties() ); } - if ($this->container['object_type_id'] === null) { - $invalidProperties[] = "'object_type_id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - if ($this->container['hidden'] === null) { - $invalidProperties[] = "'hidden' can't be null"; - } - if ($this->container['dependent_fields'] === null) { - $invalidProperties[] = "'dependent_fields' can't be null"; - } return $invalidProperties; } @@ -397,119 +397,109 @@ public function valid() /** - * Gets field_type + * Gets object_type_id * * @return string */ - public function getFieldType() + public function getObjectTypeId() { - return $this->container['field_type']; + return $this->container['object_type_id']; } /** - * Sets field_type + * Sets object_type_id * - * @param string $field_type Determines how the field will be displayed and validated. + * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. * * @return self */ - public function setFieldType($field_type) + public function setObjectTypeId($object_type_id) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($object_type_id)) { + throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['object_type_id'] = $object_type_id; return $this; } /** - * Gets object_type_id + * Gets hidden * - * @return string + * @return bool */ - public function getObjectTypeId() + public function getHidden() { - return $this->container['object_type_id']; + return $this->container['hidden']; } /** - * Sets object_type_id + * Sets hidden * - * @param string $object_type_id A unique ID for this field's CRM object type. For example a CONTACT field will have the object type ID 0-1. + * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. * * @return self */ - public function setObjectTypeId($object_type_id) + public function setHidden($hidden) { - if (is_null($object_type_id)) { - throw new \InvalidArgumentException('non-nullable object_type_id cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['object_type_id'] = $object_type_id; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets name + * Gets default_value * - * @return string + * @return string|null */ - public function getName() + public function getDefaultValue() { - return $this->container['name']; + return $this->container['default_value']; } /** - * Sets name + * Sets default_value * - * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. + * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. * * @return self */ - public function setName($name) + public function setDefaultValue($default_value) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($default_value)) { + throw new \InvalidArgumentException('non-nullable default_value cannot be null'); } - $this->container['name'] = $name; + $this->container['default_value'] = $default_value; return $this; } /** - * Gets label + * Gets name * * @return string */ - public function getLabel() + public function getName() { - return $this->container['label']; + return $this->container['name']; } /** - * Sets label + * Sets name * - * @param string $label The main label for the form field. + * @param string $name The identifier of the field. In combination with the object type ID, it must be unique. * * @return self */ - public function setLabel($label) + public function setName($name) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['label'] = $label; + $this->container['name'] = $name; return $this; } @@ -542,136 +532,146 @@ public function setDescription($description) } /** - * Gets required + * Gets dependent_fields * - * @return bool + * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] */ - public function getRequired() + public function getDependentFields() { - return $this->container['required']; + return $this->container['dependent_fields']; } /** - * Sets required + * Sets dependent_fields * - * @param bool $required Whether a value for this field is required when submitting the form. + * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. * * @return self */ - public function setRequired($required) + public function setDependentFields($dependent_fields) { - if (is_null($required)) { - throw new \InvalidArgumentException('non-nullable required cannot be null'); + if (is_null($dependent_fields)) { + throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); } - $this->container['required'] = $required; + $this->container['dependent_fields'] = $dependent_fields; return $this; } /** - * Gets hidden + * Gets label * - * @return bool + * @return string */ - public function getHidden() + public function getLabel() { - return $this->container['hidden']; + return $this->container['label']; } /** - * Sets hidden + * Sets label * - * @param bool $hidden Whether a field should be hidden or not. Hidden fields won't appear on the form, but can be used to pass a value to a property without requiring the customer to fill it in. + * @param string $label The main label for the form field. * * @return self */ - public function setHidden($hidden) + public function setLabel($label) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['label'] = $label; return $this; } /** - * Gets dependent_fields + * Gets placeholder * - * @return \HubSpot\Client\Marketing\Forms\Model\DependentField[] + * @return string|null */ - public function getDependentFields() + public function getPlaceholder() { - return $this->container['dependent_fields']; + return $this->container['placeholder']; } /** - * Sets dependent_fields + * Sets placeholder * - * @param \HubSpot\Client\Marketing\Forms\Model\DependentField[] $dependent_fields A list of other fields to make visible based on the value filled in for this field. + * @param string|null $placeholder The prompt text showing when the field isn't filled in. * * @return self */ - public function setDependentFields($dependent_fields) + public function setPlaceholder($placeholder) { - if (is_null($dependent_fields)) { - throw new \InvalidArgumentException('non-nullable dependent_fields cannot be null'); + if (is_null($placeholder)) { + throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); } - $this->container['dependent_fields'] = $dependent_fields; + $this->container['placeholder'] = $placeholder; return $this; } /** - * Gets placeholder + * Gets field_type * - * @return string|null + * @return string */ - public function getPlaceholder() + public function getFieldType() { - return $this->container['placeholder']; + return $this->container['field_type']; } /** - * Sets placeholder + * Sets field_type * - * @param string|null $placeholder The prompt text showing when the field isn't filled in. + * @param string $field_type Determines how the field will be displayed and validated. * * @return self */ - public function setPlaceholder($placeholder) + public function setFieldType($field_type) { - if (is_null($placeholder)) { - throw new \InvalidArgumentException('non-nullable placeholder cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['placeholder'] = $placeholder; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets default_value + * Gets required * - * @return string|null + * @return bool */ - public function getDefaultValue() + public function getRequired() { - return $this->container['default_value']; + return $this->container['required']; } /** - * Sets default_value + * Sets required * - * @param string|null $default_value The value filled in by default. This value will be submitted unless the customer modifies it. + * @param bool $required Whether a value for this field is required when submitting the form. * * @return self */ - public function setDefaultValue($default_value) + public function setRequired($required) { - if (is_null($default_value)) { - throw new \InvalidArgumentException('non-nullable default_value cannot be null'); + if (is_null($required)) { + throw new \InvalidArgumentException('non-nullable required cannot be null'); } - $this->container['default_value'] = $default_value; + $this->container['required'] = $required; return $this; } diff --git a/codegen/Marketing/Forms/ObjectSerializer.php b/codegen/Marketing/Forms/ObjectSerializer.php index 0e55e67a7..8592ef3eb 100644 --- a/codegen/Marketing/Forms/ObjectSerializer.php +++ b/codegen/Marketing/Forms/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php b/codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php index 9d3a821ae..dcb357a82 100644 --- a/codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php +++ b/codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php @@ -10,13 +10,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class PublicSMTPTokensApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveTokenWithHttpInfo($token_id, string $contentType = self:: $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -431,18 +419,6 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -501,6 +477,19 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -776,18 +765,6 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self:: $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -846,6 +823,19 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self:: ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1071,10 +1061,10 @@ public function getTokenByIdRequest($token_id, string $contentType = self::conte * * Query SMTP API tokens by campaign name or an emailCampaignId. * - * @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional) - * @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) - * @param string $after Starting point to get the next set of results. (optional) - * @param int $limit Maximum number of tokens to return. (optional) + * @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional) + * @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) + * @param string|null $after Starting point to get the next set of results. (optional) + * @param int|null $limit Maximum number of tokens to return. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation * * @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, * * Query SMTP API tokens by campaign name or an emailCampaignId. * - * @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional) - * @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) - * @param string $after Starting point to get the next set of results. (optional) - * @param int $limit Maximum number of tokens to return. (optional) + * @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional) + * @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) + * @param string|null $after Starting point to get the next set of results. (optional) + * @param int|null $limit Maximum number of tokens to return. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation * * @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 $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1198,6 +1176,19 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1254,10 +1245,10 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign * * Query SMTP API tokens by campaign name or an emailCampaignId. * - * @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional) - * @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) - * @param string $after Starting point to get the next set of results. (optional) - * @param int $limit Maximum number of tokens to return. (optional) + * @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional) + * @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) + * @param string|null $after Starting point to get the next set of results. (optional) + * @param int|null $limit Maximum number of tokens to return. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1278,10 +1269,10 @@ function ($response) { * * Query SMTP API tokens by campaign name or an emailCampaignId. * - * @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional) - * @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) - * @param string $after Starting point to get the next set of results. (optional) - * @param int $limit Maximum number of tokens to return. (optional) + * @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional) + * @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) + * @param string|null $after Starting point to get the next set of results. (optional) + * @param int|null $limit Maximum number of tokens to return. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1331,10 +1322,10 @@ function ($exception) { /** * Create request for operation 'getTokensPage' * - * @param string $campaign_name A name for the campaign tied to the SMTP API token. (optional) - * @param string $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) - * @param string $after Starting point to get the next set of results. (optional) - * @param int $limit Maximum number of tokens to return. (optional) + * @param string|null $campaign_name A name for the campaign tied to the SMTP API token. (optional) + * @param string|null $email_campaign_id Identifier assigned to the campaign provided during the token creation. (optional) + * @param string|null $after Starting point to get the next set of results. (optional) + * @param int|null $limit Maximum number of tokens to return. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTokensPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1508,18 +1499,6 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self: $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1578,6 +1557,19 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self: ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Marketing/Transactional/Api/SingleSendApi.php b/codegen/Marketing/Transactional/Api/SingleSendApi.php index 6199808e1..7586554d1 100644 --- a/codegen/Marketing/Transactional/Api/SingleSendApi.php +++ b/codegen/Marketing/Transactional/Api/SingleSendApi.php @@ -10,13 +10,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SingleSendApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -178,18 +178,6 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -248,6 +236,19 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Marketing\Transactional\Model\EmailSendStatusView'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Marketing/Transactional/ApiException.php b/codegen/Marketing/Transactional/ApiException.php index 12b98e742..620bdc1b4 100644 --- a/codegen/Marketing/Transactional/ApiException.php +++ b/codegen/Marketing/Transactional/ApiException.php @@ -10,13 +10,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Marketing/Transactional/Configuration.php b/codegen/Marketing/Transactional/Configuration.php index 4ed6238a6..d764ea7ce 100644 --- a/codegen/Marketing/Transactional/Configuration.php +++ b/codegen/Marketing/Transactional/Configuration.php @@ -10,13 +10,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Marketing/Transactional/HeaderSelector.php b/codegen/Marketing/Transactional/HeaderSelector.php index 99334fead..c8db1b3ad 100644 --- a/codegen/Marketing/Transactional/HeaderSelector.php +++ b/codegen/Marketing/Transactional/HeaderSelector.php @@ -10,13 +10,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Marketing/Transactional/Model/CollectionResponseSmtpApiTokenViewForwardPaging.php b/codegen/Marketing/Transactional/Model/CollectionResponseSmtpApiTokenViewForwardPaging.php index 2fa815105..708ef518d 100644 --- a/codegen/Marketing/Transactional/Model/CollectionResponseSmtpApiTokenViewForwardPaging.php +++ b/codegen/Marketing/Transactional/Model/CollectionResponseSmtpApiTokenViewForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/EmailSendStatusView.php b/codegen/Marketing/Transactional/Model/EmailSendStatusView.php index ce06412a5..207427840 100644 --- a/codegen/Marketing/Transactional/Model/EmailSendStatusView.php +++ b/codegen/Marketing/Transactional/Model/EmailSendStatusView.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -392,10 +392,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('event_id', $data ?? [], null); $this->setIfExists('completed_at', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/Error.php b/codegen/Marketing/Transactional/Model/Error.php index 2a74a0f7b..4be589260 100644 --- a/codegen/Marketing/Transactional/Model/Error.php +++ b/codegen/Marketing/Transactional/Model/Error.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/ErrorDetail.php b/codegen/Marketing/Transactional/Model/ErrorDetail.php index 55ff9056e..a55cc9779 100644 --- a/codegen/Marketing/Transactional/Model/ErrorDetail.php +++ b/codegen/Marketing/Transactional/Model/ErrorDetail.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/EventIdView.php b/codegen/Marketing/Transactional/Model/EventIdView.php index d7038f9c3..540063985 100644 --- a/codegen/Marketing/Transactional/Model/EventIdView.php +++ b/codegen/Marketing/Transactional/Model/EventIdView.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/ForwardPaging.php b/codegen/Marketing/Transactional/Model/ForwardPaging.php index 180f95022..ce8a5d9b6 100644 --- a/codegen/Marketing/Transactional/Model/ForwardPaging.php +++ b/codegen/Marketing/Transactional/Model/ForwardPaging.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Marketing/Transactional/Model/ModelInterface.php b/codegen/Marketing/Transactional/Model/ModelInterface.php index 0ac74a6d9..6fc892d7e 100644 --- a/codegen/Marketing/Transactional/Model/ModelInterface.php +++ b/codegen/Marketing/Transactional/Model/ModelInterface.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Marketing/Transactional/Model/NextPage.php b/codegen/Marketing/Transactional/Model/NextPage.php index 4d55bc3dd..3bc2fb785 100644 --- a/codegen/Marketing/Transactional/Model/NextPage.php +++ b/codegen/Marketing/Transactional/Model/NextPage.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/PublicSingleSendEmail.php b/codegen/Marketing/Transactional/Model/PublicSingleSendEmail.php index 8a03668b9..652c9abca 100644 --- a/codegen/Marketing/Transactional/Model/PublicSingleSendEmail.php +++ b/codegen/Marketing/Transactional/Model/PublicSingleSendEmail.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -270,10 +270,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('cc', $data ?? [], null); $this->setIfExists('send_id', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php b/codegen/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php index 283dc76f1..d3936b270 100644 --- a/codegen/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php +++ b/codegen/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('custom_properties', $data ?? [], null); $this->setIfExists('email_id', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php b/codegen/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php index d6e373e70..2c8a20705 100644 --- a/codegen/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php +++ b/codegen/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('create_contact', $data ?? [], null); $this->setIfExists('campaign_name', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/Model/SmtpApiTokenView.php b/codegen/Marketing/Transactional/Model/SmtpApiTokenView.php index b75fedf01..9448e2aed 100644 --- a/codegen/Marketing/Transactional/Model/SmtpApiTokenView.php +++ b/codegen/Marketing/Transactional/Model/SmtpApiTokenView.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('password', $data ?? [], null); diff --git a/codegen/Marketing/Transactional/ObjectSerializer.php b/codegen/Marketing/Transactional/ObjectSerializer.php index db8aa45d8..b2a820987 100644 --- a/codegen/Marketing/Transactional/ObjectSerializer.php +++ b/codegen/Marketing/Transactional/ObjectSerializer.php @@ -11,13 +11,13 @@ */ /** - * Marketing Transactional Single Send + * Transactional Single Send * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Oauth/Api/AccessTokensApi.php b/codegen/Oauth/Api/AccessTokensApi.php index 04a0e561b..ba9c0e4ef 100644 --- a/codegen/Oauth/Api/AccessTokensApi.php +++ b/codegen/Oauth/Api/AccessTokensApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class AccessTokensApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,7 +125,9 @@ public function getConfig() /** * Operation get * - * @param string $token token (required) + * Retrieve OAuth token metadata + * + * @param string $token The access token that you want to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -141,7 +143,9 @@ public function get($token, string $contentType = self::contentTypes['get'][0]) /** * Operation getWithHttpInfo * - * @param string $token (required) + * Retrieve OAuth token metadata + * + * @param string $token The access token that you want to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -174,18 +178,6 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Oauth\Model\AccessTokenInfoResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,7 +303,9 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes /** * Operation getAsync * - * @param string $token (required) + * Retrieve OAuth token metadata + * + * @param string $token The access token that you want to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -317,7 +324,9 @@ function ($response) { /** * Operation getAsyncWithHttpInfo * - * @param string $token (required) + * Retrieve OAuth token metadata + * + * @param string $token The access token that you want to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -367,7 +376,7 @@ function ($exception) { /** * Create request for operation 'get' * - * @param string $token (required) + * @param string $token The access token that you want to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Oauth/Api/RefreshTokensApi.php b/codegen/Oauth/Api/RefreshTokensApi.php index 83b88008d..d1af3d1a9 100644 --- a/codegen/Oauth/Api/RefreshTokensApi.php +++ b/codegen/Oauth/Api/RefreshTokensApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -86,13 +86,13 @@ class RefreshTokensApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -128,7 +128,9 @@ public function getConfig() /** * Operation archive * - * @param string $token token (required) + * Delete a refresh token + * + * @param string $token The refresh token to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -143,7 +145,9 @@ public function archive($token, string $contentType = self::contentTypes['archiv /** * Operation archiveWithHttpInfo * - * @param string $token (required) + * Delete a refresh token + * + * @param string $token The refresh token to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -176,18 +180,6 @@ public function archiveWithHttpInfo($token, string $contentType = self::contentT $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -209,7 +201,9 @@ public function archiveWithHttpInfo($token, string $contentType = self::contentT /** * Operation archiveAsync * - * @param string $token (required) + * Delete a refresh token + * + * @param string $token The refresh token to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -228,7 +222,9 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * @param string $token (required) + * Delete a refresh token + * + * @param string $token The refresh token to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -265,7 +261,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $token (required) + * @param string $token The refresh token to delete. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -357,7 +353,9 @@ public function archiveRequest($token, string $contentType = self::contentTypes[ /** * Operation get * - * @param string $token token (required) + * Retrieve refresh token metadata + * + * @param string $token The refresh token to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -373,7 +371,9 @@ public function get($token, string $contentType = self::contentTypes['get'][0]) /** * Operation getWithHttpInfo * - * @param string $token (required) + * Retrieve refresh token metadata + * + * @param string $token The refresh token to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -406,18 +406,6 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -476,6 +464,19 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Oauth\Model\RefreshTokenInfoResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -530,7 +531,9 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes /** * Operation getAsync * - * @param string $token (required) + * Retrieve refresh token metadata + * + * @param string $token The refresh token to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -549,7 +552,9 @@ function ($response) { /** * Operation getAsyncWithHttpInfo * - * @param string $token (required) + * Retrieve refresh token metadata + * + * @param string $token The refresh token to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -599,7 +604,7 @@ function ($exception) { /** * Create request for operation 'get' * - * @param string $token (required) + * @param string $token The refresh token to retrieve information about. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Oauth/Api/TokensApi.php b/codegen/Oauth/Api/TokensApi.php index a05c7b2f9..25907b3cd 100644 --- a/codegen/Oauth/Api/TokensApi.php +++ b/codegen/Oauth/Api/TokensApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class TokensApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,12 +125,14 @@ public function getConfig() /** * Operation create * - * @param string $grant_type grant_type (optional) - * @param string $code code (optional) - * @param string $redirect_uri redirect_uri (optional) - * @param string $client_id client_id (optional) - * @param string $client_secret client_secret (optional) - * @param string $refresh_token refresh_token (optional) + * Refresh an access token + * + * @param string|null $grant_type grant_type (optional) + * @param string|null $code code (optional) + * @param string|null $redirect_uri redirect_uri (optional) + * @param string|null $client_id client_id (optional) + * @param string|null $client_secret client_secret (optional) + * @param string|null $refresh_token refresh_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -146,12 +148,14 @@ public function create($grant_type = null, $code = null, $redirect_uri = null, $ /** * Operation createWithHttpInfo * - * @param string $grant_type (optional) - * @param string $code (optional) - * @param string $redirect_uri (optional) - * @param string $client_id (optional) - * @param string $client_secret (optional) - * @param string $refresh_token (optional) + * Refresh an access token + * + * @param string|null $grant_type (optional) + * @param string|null $code (optional) + * @param string|null $redirect_uri (optional) + * @param string|null $client_id (optional) + * @param string|null $client_secret (optional) + * @param string|null $refresh_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format @@ -184,18 +188,6 @@ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_u $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -254,6 +246,19 @@ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_u ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Oauth\Model\TokenResponseIF'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -308,12 +313,14 @@ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_u /** * Operation createAsync * - * @param string $grant_type (optional) - * @param string $code (optional) - * @param string $redirect_uri (optional) - * @param string $client_id (optional) - * @param string $client_secret (optional) - * @param string $refresh_token (optional) + * Refresh an access token + * + * @param string|null $grant_type (optional) + * @param string|null $code (optional) + * @param string|null $redirect_uri (optional) + * @param string|null $client_id (optional) + * @param string|null $client_secret (optional) + * @param string|null $refresh_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -332,12 +339,14 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * @param string $grant_type (optional) - * @param string $code (optional) - * @param string $redirect_uri (optional) - * @param string $client_id (optional) - * @param string $client_secret (optional) - * @param string $refresh_token (optional) + * Refresh an access token + * + * @param string|null $grant_type (optional) + * @param string|null $code (optional) + * @param string|null $redirect_uri (optional) + * @param string|null $client_id (optional) + * @param string|null $client_secret (optional) + * @param string|null $refresh_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -387,12 +396,12 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $grant_type (optional) - * @param string $code (optional) - * @param string $redirect_uri (optional) - * @param string $client_id (optional) - * @param string $client_secret (optional) - * @param string $refresh_token (optional) + * @param string|null $grant_type (optional) + * @param string|null $code (optional) + * @param string|null $redirect_uri (optional) + * @param string|null $client_id (optional) + * @param string|null $client_secret (optional) + * @param string|null $refresh_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Oauth/ApiException.php b/codegen/Oauth/ApiException.php index 6bf7de3f7..64105239d 100644 --- a/codegen/Oauth/ApiException.php +++ b/codegen/Oauth/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Oauth/Configuration.php b/codegen/Oauth/Configuration.php index 4baacf1d0..a998f41a8 100644 --- a/codegen/Oauth/Configuration.php +++ b/codegen/Oauth/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Oauth/HeaderSelector.php b/codegen/Oauth/HeaderSelector.php index c7d69015c..0e4258711 100644 --- a/codegen/Oauth/HeaderSelector.php +++ b/codegen/Oauth/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Oauth/Model/AccessTokenInfoResponse.php b/codegen/Oauth/Model/AccessTokenInfoResponse.php index f8ddeb24e..50b422790 100644 --- a/codegen/Oauth/Model/AccessTokenInfoResponse.php +++ b/codegen/Oauth/Model/AccessTokenInfoResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -287,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hub_id', $data ?? [], null); $this->setIfExists('user_id', $data ?? [], null); diff --git a/codegen/Oauth/Model/Error.php b/codegen/Oauth/Model/Error.php index be0669aff..49fa2bab2 100644 --- a/codegen/Oauth/Model/Error.php +++ b/codegen/Oauth/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Oauth/Model/ErrorDetail.php b/codegen/Oauth/Model/ErrorDetail.php index 379d05012..831caff24 100644 --- a/codegen/Oauth/Model/ErrorDetail.php +++ b/codegen/Oauth/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Oauth/Model/ModelInterface.php b/codegen/Oauth/Model/ModelInterface.php index 2a2d53d22..2d082ed48 100644 --- a/codegen/Oauth/Model/ModelInterface.php +++ b/codegen/Oauth/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Oauth/Model/RefreshTokenInfoResponse.php b/codegen/Oauth/Model/RefreshTokenInfoResponse.php index 8b455ac38..3a13f07ff 100644 --- a/codegen/Oauth/Model/RefreshTokenInfoResponse.php +++ b/codegen/Oauth/Model/RefreshTokenInfoResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('hub_id', $data ?? [], null); $this->setIfExists('user_id', $data ?? [], null); diff --git a/codegen/Oauth/Model/TokenResponseIF.php b/codegen/Oauth/Model/TokenResponseIF.php index 9dab01067..9b701f0cd 100644 --- a/codegen/Oauth/Model/TokenResponseIF.php +++ b/codegen/Oauth/Model/TokenResponseIF.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('access_token', $data ?? [], null); $this->setIfExists('refresh_token', $data ?? [], null); diff --git a/codegen/Oauth/ObjectSerializer.php b/codegen/Oauth/ObjectSerializer.php index 90ae635dd..76ad33eb3 100644 --- a/codegen/Oauth/ObjectSerializer.php +++ b/codegen/Oauth/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Settings/BusinessUnits/Api/BusinessUnitApi.php b/codegen/Settings/BusinessUnits/Api/BusinessUnitApi.php index b12948e4c..c27e76a97 100644 --- a/codegen/Settings/BusinessUnits/Api/BusinessUnitApi.php +++ b/codegen/Settings/BusinessUnits/Api/BusinessUnitApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class BusinessUnitApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -128,8 +128,8 @@ public function getConfig() * Get Business Units for a user * * @param string $user_id Identifier of user to retrieve. (required) - * @param string[] $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) - * @param string[] $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) + * @param string[]|null $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) + * @param string[]|null $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByUserID'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\BusinessUnits\ApiException on non-2xx response or if the response body is not in the expected format @@ -148,8 +148,8 @@ public function getByUserID($user_id, $properties = null, $name = null, string $ * Get Business Units for a user * * @param string $user_id Identifier of user to retrieve. (required) - * @param string[] $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) - * @param string[] $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) + * @param string[]|null $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) + * @param string[]|null $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByUserID'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\BusinessUnits\ApiException on non-2xx response or if the response body is not in the expected format @@ -182,18 +182,6 @@ public function getByUserIDWithHttpInfo($user_id, $properties = null, $name = nu $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -252,6 +240,19 @@ public function getByUserIDWithHttpInfo($user_id, $properties = null, $name = nu ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Settings\BusinessUnits\Model\CollectionResponsePublicBusinessUnitNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -309,8 +310,8 @@ public function getByUserIDWithHttpInfo($user_id, $properties = null, $name = nu * Get Business Units for a user * * @param string $user_id Identifier of user to retrieve. (required) - * @param string[] $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) - * @param string[] $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) + * @param string[]|null $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) + * @param string[]|null $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByUserID'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -332,8 +333,8 @@ function ($response) { * Get Business Units for a user * * @param string $user_id Identifier of user to retrieve. (required) - * @param string[] $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) - * @param string[] $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) + * @param string[]|null $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) + * @param string[]|null $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByUserID'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -384,8 +385,8 @@ function ($exception) { * Create request for operation 'getByUserID' * * @param string $user_id Identifier of user to retrieve. (required) - * @param string[] $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) - * @param string[] $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) + * @param string[]|null $properties The names of properties to optionally include in the response body. The only valid value is `logoMetadata`. (optional) + * @param string[]|null $name The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByUserID'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Settings/BusinessUnits/ApiException.php b/codegen/Settings/BusinessUnits/ApiException.php index bb12880d7..3cef06acf 100644 --- a/codegen/Settings/BusinessUnits/ApiException.php +++ b/codegen/Settings/BusinessUnits/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Settings/BusinessUnits/Configuration.php b/codegen/Settings/BusinessUnits/Configuration.php index cc999c99b..2e0a7783e 100644 --- a/codegen/Settings/BusinessUnits/Configuration.php +++ b/codegen/Settings/BusinessUnits/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Settings/BusinessUnits/HeaderSelector.php b/codegen/Settings/BusinessUnits/HeaderSelector.php index 1415c13a9..75b882d70 100644 --- a/codegen/Settings/BusinessUnits/HeaderSelector.php +++ b/codegen/Settings/BusinessUnits/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Settings/BusinessUnits/Model/CollectionResponsePublicBusinessUnitNoPaging.php b/codegen/Settings/BusinessUnits/Model/CollectionResponsePublicBusinessUnitNoPaging.php index 5b84667e8..50129875f 100644 --- a/codegen/Settings/BusinessUnits/Model/CollectionResponsePublicBusinessUnitNoPaging.php +++ b/codegen/Settings/BusinessUnits/Model/CollectionResponsePublicBusinessUnitNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Settings/BusinessUnits/Model/Error.php b/codegen/Settings/BusinessUnits/Model/Error.php index 87ccb7b67..f8815c839 100644 --- a/codegen/Settings/BusinessUnits/Model/Error.php +++ b/codegen/Settings/BusinessUnits/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Settings/BusinessUnits/Model/ErrorDetail.php b/codegen/Settings/BusinessUnits/Model/ErrorDetail.php index 7ca03608c..be15d9835 100644 --- a/codegen/Settings/BusinessUnits/Model/ErrorDetail.php +++ b/codegen/Settings/BusinessUnits/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Settings/BusinessUnits/Model/ModelInterface.php b/codegen/Settings/BusinessUnits/Model/ModelInterface.php index acadfb940..a39ecd222 100644 --- a/codegen/Settings/BusinessUnits/Model/ModelInterface.php +++ b/codegen/Settings/BusinessUnits/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Settings/BusinessUnits/Model/PublicBusinessUnit.php b/codegen/Settings/BusinessUnits/Model/PublicBusinessUnit.php index 2f24357c4..b44bf3d24 100644 --- a/codegen/Settings/BusinessUnits/Model/PublicBusinessUnit.php +++ b/codegen/Settings/BusinessUnits/Model/PublicBusinessUnit.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('logo_metadata', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Settings/BusinessUnits/Model/PublicBusinessUnitLogoMetadata.php b/codegen/Settings/BusinessUnits/Model/PublicBusinessUnitLogoMetadata.php index 92ee7ea22..c7b522c33 100644 --- a/codegen/Settings/BusinessUnits/Model/PublicBusinessUnitLogoMetadata.php +++ b/codegen/Settings/BusinessUnits/Model/PublicBusinessUnitLogoMetadata.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('logo_alt_text', $data ?? [], null); $this->setIfExists('resized_url', $data ?? [], null); diff --git a/codegen/Settings/BusinessUnits/ObjectSerializer.php b/codegen/Settings/BusinessUnits/ObjectSerializer.php index 69540bb4c..cda821616 100644 --- a/codegen/Settings/BusinessUnits/ObjectSerializer.php +++ b/codegen/Settings/BusinessUnits/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Settings/Users/Api/RolesApi.php b/codegen/Settings/Users/Api/RolesApi.php index 52ac54b2a..3287ef05f 100644 --- a/codegen/Settings/Users/Api/RolesApi.php +++ b/codegen/Settings/Users/Api/RolesApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class RolesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -176,18 +176,6 @@ public function getAllWithHttpInfo(string $contentType = self::contentTypes['get $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -246,6 +234,19 @@ public function getAllWithHttpInfo(string $contentType = self::contentTypes['get ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Settings\Users\Model\CollectionResponsePublicPermissionSetNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Settings/Users/Api/TeamsApi.php b/codegen/Settings/Users/Api/TeamsApi.php index 2cdcf80eb..c3ccd3800 100644 --- a/codegen/Settings/Users/Api/TeamsApi.php +++ b/codegen/Settings/Users/Api/TeamsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class TeamsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -176,18 +176,6 @@ public function getAllWithHttpInfo(string $contentType = self::contentTypes['get $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -246,6 +234,19 @@ public function getAllWithHttpInfo(string $contentType = self::contentTypes['get ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Settings\Users\Model\CollectionResponsePublicTeamNoPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Settings/Users/Api/UsersApi.php b/codegen/Settings/Users/Api/UsersApi.php index 7bdeff4c1..765f2769b 100644 --- a/codegen/Settings/Users/Api/UsersApi.php +++ b/codegen/Settings/Users/Api/UsersApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class UsersApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -140,7 +140,7 @@ public function getConfig() * Removes a user * * @param string $user_id Identifier of user to delete (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -158,7 +158,7 @@ public function archive($user_id, $id_property = null, string $contentType = sel * Removes a user * * @param string $user_id Identifier of user to delete (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -191,18 +191,6 @@ public function archiveWithHttpInfo($user_id, $id_property = null, string $conte $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -227,7 +215,7 @@ public function archiveWithHttpInfo($user_id, $id_property = null, string $conte * Removes a user * * @param string $user_id Identifier of user to delete (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -249,7 +237,7 @@ function ($response) { * Removes a user * * @param string $user_id Identifier of user to delete (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -287,7 +275,7 @@ function ($exception) { * Create request for operation 'archive' * * @param string $user_id Identifier of user to delete (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -446,18 +434,6 @@ public function createWithHttpInfo($user_provision_request, string $contentType $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -516,6 +492,19 @@ public function createWithHttpInfo($user_provision_request, string $contentType ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Settings\Users\Model\PublicUser'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -741,7 +730,7 @@ public function createRequest($user_provision_request, string $contentType = sel * Retrieves a user * * @param string $user_id Identifier of user to retrieve (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -760,7 +749,7 @@ public function getById($user_id, $id_property = null, string $contentType = sel * Retrieves a user * * @param string $user_id Identifier of user to retrieve (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -793,18 +782,6 @@ public function getByIdWithHttpInfo($user_id, $id_property = null, string $conte $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -863,6 +840,19 @@ public function getByIdWithHttpInfo($user_id, $id_property = null, string $conte ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Settings\Users\Model\PublicUser'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -920,7 +910,7 @@ public function getByIdWithHttpInfo($user_id, $id_property = null, string $conte * Retrieves a user * * @param string $user_id Identifier of user to retrieve (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -942,7 +932,7 @@ function ($response) { * Retrieves a user * * @param string $user_id Identifier of user to retrieve (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,7 +983,7 @@ function ($exception) { * Create request for operation 'getById' * * @param string $user_id Identifier of user to retrieve (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1101,8 +1091,8 @@ public function getByIdRequest($user_id, $id_property = null, string $contentTyp * * Retrieves a list of users from an account * - * @param int $limit The number of users to retrieve (optional) - * @param string $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) + * @param int|null $limit The number of users to retrieve (optional) + * @param string|null $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -1120,8 +1110,8 @@ public function getPage($limit = null, $after = null, string $contentType = self * * Retrieves a list of users from an account * - * @param int $limit The number of users to retrieve (optional) - * @param string $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) + * @param int|null $limit The number of users to retrieve (optional) + * @param string|null $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -1154,18 +1144,6 @@ public function getPageWithHttpInfo($limit = null, $after = null, string $conten $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1224,6 +1202,19 @@ public function getPageWithHttpInfo($limit = null, $after = null, string $conten ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Settings\Users\Model\CollectionResponsePublicUserForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1280,8 +1271,8 @@ public function getPageWithHttpInfo($limit = null, $after = null, string $conten * * Retrieves a list of users from an account * - * @param int $limit The number of users to retrieve (optional) - * @param string $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) + * @param int|null $limit The number of users to retrieve (optional) + * @param string|null $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1302,8 +1293,8 @@ function ($response) { * * Retrieves a list of users from an account * - * @param int $limit The number of users to retrieve (optional) - * @param string $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) + * @param int|null $limit The number of users to retrieve (optional) + * @param string|null $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1353,8 +1344,8 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The number of users to retrieve (optional) - * @param string $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) + * @param int|null $limit The number of users to retrieve (optional) + * @param string|null $after Results will display maximum 100 users per page. Additional results will be on the next page. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1459,7 +1450,7 @@ public function getPageRequest($limit = null, $after = null, string $contentType * * @param string $user_id Identifier of user to retrieve (required) * @param \HubSpot\Client\Settings\Users\Model\PublicUserUpdate $public_user_update public_user_update (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -1479,7 +1470,7 @@ public function replace($user_id, $public_user_update, $id_property = null, stri * * @param string $user_id Identifier of user to retrieve (required) * @param \HubSpot\Client\Settings\Users\Model\PublicUserUpdate $public_user_update (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \HubSpot\Client\Settings\Users\ApiException on non-2xx response or if the response body is not in the expected format @@ -1512,18 +1503,6 @@ public function replaceWithHttpInfo($user_id, $public_user_update, $id_property $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1582,6 +1561,19 @@ public function replaceWithHttpInfo($user_id, $public_user_update, $id_property ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Settings\Users\Model\PublicUser'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1640,7 +1632,7 @@ public function replaceWithHttpInfo($user_id, $public_user_update, $id_property * * @param string $user_id Identifier of user to retrieve (required) * @param \HubSpot\Client\Settings\Users\Model\PublicUserUpdate $public_user_update (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1663,7 +1655,7 @@ function ($response) { * * @param string $user_id Identifier of user to retrieve (required) * @param \HubSpot\Client\Settings\Users\Model\PublicUserUpdate $public_user_update (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1715,7 +1707,7 @@ function ($exception) { * * @param string $user_id Identifier of user to retrieve (required) * @param \HubSpot\Client\Settings\Users\Model\PublicUserUpdate $public_user_update (required) - * @param string $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) + * @param string|null $id_property The name of a property with unique user values. Valid values are `USER_ID`(default) or `EMAIL` (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/codegen/Settings/Users/ApiException.php b/codegen/Settings/Users/ApiException.php index bb1e8b7a6..05e08e806 100644 --- a/codegen/Settings/Users/ApiException.php +++ b/codegen/Settings/Users/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Settings/Users/Configuration.php b/codegen/Settings/Users/Configuration.php index 959ef92c2..a9b936e87 100644 --- a/codegen/Settings/Users/Configuration.php +++ b/codegen/Settings/Users/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Settings/Users/HeaderSelector.php b/codegen/Settings/Users/HeaderSelector.php index fba213487..5a11e77a3 100644 --- a/codegen/Settings/Users/HeaderSelector.php +++ b/codegen/Settings/Users/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Settings/Users/Model/CollectionResponsePublicPermissionSetNoPaging.php b/codegen/Settings/Users/Model/CollectionResponsePublicPermissionSetNoPaging.php index a48cdfb1a..66da11475 100644 --- a/codegen/Settings/Users/Model/CollectionResponsePublicPermissionSetNoPaging.php +++ b/codegen/Settings/Users/Model/CollectionResponsePublicPermissionSetNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Settings/Users/Model/CollectionResponsePublicTeamNoPaging.php b/codegen/Settings/Users/Model/CollectionResponsePublicTeamNoPaging.php index 3682e7503..0ae1fddce 100644 --- a/codegen/Settings/Users/Model/CollectionResponsePublicTeamNoPaging.php +++ b/codegen/Settings/Users/Model/CollectionResponsePublicTeamNoPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Settings/Users/Model/CollectionResponsePublicUserForwardPaging.php b/codegen/Settings/Users/Model/CollectionResponsePublicUserForwardPaging.php index a2c3a37cb..9dfd9c5f3 100644 --- a/codegen/Settings/Users/Model/CollectionResponsePublicUserForwardPaging.php +++ b/codegen/Settings/Users/Model/CollectionResponsePublicUserForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/Error.php b/codegen/Settings/Users/Model/Error.php index 82e0dc2ed..6e14ddd24 100644 --- a/codegen/Settings/Users/Model/Error.php +++ b/codegen/Settings/Users/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/ErrorDetail.php b/codegen/Settings/Users/Model/ErrorDetail.php index 3f1a5a75a..44d76ff9a 100644 --- a/codegen/Settings/Users/Model/ErrorDetail.php +++ b/codegen/Settings/Users/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/ForwardPaging.php b/codegen/Settings/Users/Model/ForwardPaging.php index 59b65c157..972d10baa 100644 --- a/codegen/Settings/Users/Model/ForwardPaging.php +++ b/codegen/Settings/Users/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Settings/Users/Model/ModelInterface.php b/codegen/Settings/Users/Model/ModelInterface.php index d2bc1d3bd..e293a3cdb 100644 --- a/codegen/Settings/Users/Model/ModelInterface.php +++ b/codegen/Settings/Users/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Settings/Users/Model/NextPage.php b/codegen/Settings/Users/Model/NextPage.php index a63d3a4d5..a3693cd71 100644 --- a/codegen/Settings/Users/Model/NextPage.php +++ b/codegen/Settings/Users/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/PublicPermissionSet.php b/codegen/Settings/Users/Model/PublicPermissionSet.php index 7da185258..d187c3fb1 100644 --- a/codegen/Settings/Users/Model/PublicPermissionSet.php +++ b/codegen/Settings/Users/Model/PublicPermissionSet.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -252,10 +252,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('requires_billing_write', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/PublicTeam.php b/codegen/Settings/Users/Model/PublicTeam.php index 1a62f2968..082bfd797 100644 --- a/codegen/Settings/Users/Model/PublicTeam.php +++ b/codegen/Settings/Users/Model/PublicTeam.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('user_ids', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/PublicUser.php b/codegen/Settings/Users/Model/PublicUser.php index d32edc7f9..efe609b17 100644 --- a/codegen/Settings/Users/Model/PublicUser.php +++ b/codegen/Settings/Users/Model/PublicUser.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -294,10 +294,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('first_name', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/PublicUserUpdate.php b/codegen/Settings/Users/Model/PublicUserUpdate.php index 88799fc8a..7c1db1631 100644 --- a/codegen/Settings/Users/Model/PublicUserUpdate.php +++ b/codegen/Settings/Users/Model/PublicUserUpdate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -264,10 +264,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('first_name', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); diff --git a/codegen/Settings/Users/Model/UserProvisionRequest.php b/codegen/Settings/Users/Model/UserProvisionRequest.php index b090df0c9..dacac9238 100644 --- a/codegen/Settings/Users/Model/UserProvisionRequest.php +++ b/codegen/Settings/Users/Model/UserProvisionRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -276,10 +276,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('first_name', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); diff --git a/codegen/Settings/Users/ObjectSerializer.php b/codegen/Settings/Users/ObjectSerializer.php index e2fec8151..1f84371df 100644 --- a/codegen/Settings/Users/ObjectSerializer.php +++ b/codegen/Settings/Users/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Webhooks/Api/SettingsApi.php b/codegen/Webhooks/Api/SettingsApi.php index 4cd2a201f..e0f002d78 100644 --- a/codegen/Webhooks/Api/SettingsApi.php +++ b/codegen/Webhooks/Api/SettingsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -89,13 +89,13 @@ class SettingsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -183,18 +183,6 @@ public function clearWithHttpInfo($app_id, string $contentType = self::contentTy $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -373,7 +361,7 @@ public function clearRequest($app_id, string $contentType = self::contentTypes[' /** * Operation configure * - * Delete webhook settings + * Update webhook settings * * @param int $app_id The ID of the app. (required) * @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 /** * Operation configureWithHttpInfo * - * Delete webhook settings + * Update webhook settings * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required) @@ -428,18 +416,6 @@ public function configureWithHttpInfo($app_id, $settings_change_request, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -498,6 +474,19 @@ public function configureWithHttpInfo($app_id, $settings_change_request, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Webhooks\Model\SettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -552,7 +541,7 @@ public function configureWithHttpInfo($app_id, $settings_change_request, string /** * Operation configureAsync * - * Delete webhook settings + * Update webhook settings * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required) @@ -574,7 +563,7 @@ function ($response) { /** * Operation configureAsyncWithHttpInfo * - * Delete webhook settings + * Update webhook settings * * @param int $app_id The ID of the app. (required) * @param \HubSpot\Client\Webhooks\Model\SettingsChangeRequest $settings_change_request (required) @@ -792,18 +781,6 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -862,6 +839,19 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Webhooks\Model\SettingsResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Webhooks/Api/SubscriptionsApi.php b/codegen/Webhooks/Api/SubscriptionsApi.php index 0ee570f9e..e700f706e 100644 --- a/codegen/Webhooks/Api/SubscriptionsApi.php +++ b/codegen/Webhooks/Api/SubscriptionsApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -98,13 +98,13 @@ class SubscriptionsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -194,18 +194,6 @@ public function archiveWithHttpInfo($subscription_id, $app_id, string $contentTy $statusCode = $response->getStatusCode(); - 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 [null, $statusCode, $response->getHeaders()]; @@ -457,18 +445,6 @@ public function createWithHttpInfo($app_id, $subscription_create_request, string $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($app_id, $subscription_create_request, string ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -821,18 +810,6 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -891,6 +868,19 @@ public function getAllWithHttpInfo($app_id, string $contentType = self::contentT ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionListResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1170,18 +1160,6 @@ public function getByIdWithHttpInfo($subscription_id, $app_id, string $contentTy $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1240,6 +1218,19 @@ public function getByIdWithHttpInfo($subscription_id, $app_id, string $contentTy ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1539,18 +1530,6 @@ public function updateWithHttpInfo($subscription_id, $app_id, $subscription_patc $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -1609,6 +1588,19 @@ public function updateWithHttpInfo($subscription_id, $app_id, $subscription_patc ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Webhooks\Model\SubscriptionResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1923,18 +1915,6 @@ public function updateBatchWithHttpInfo($app_id, $batch_input_subscription_batch $statusCode = $response->getStatusCode(); - 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() - ); - } switch($statusCode) { case 200: @@ -2020,6 +2000,19 @@ public function updateBatchWithHttpInfo($app_id, $batch_input_subscription_batch ]; } + 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() + ); + } + $returnType = '\HubSpot\Client\Webhooks\Model\BatchResponseSubscriptionResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Webhooks/ApiException.php b/codegen/Webhooks/ApiException.php index f343d5c6a..aba1f5887 100644 --- a/codegen/Webhooks/ApiException.php +++ b/codegen/Webhooks/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Webhooks/Configuration.php b/codegen/Webhooks/Configuration.php index 364157e1d..2a2acc105 100644 --- a/codegen/Webhooks/Configuration.php +++ b/codegen/Webhooks/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Webhooks/HeaderSelector.php b/codegen/Webhooks/HeaderSelector.php index 8ecce21d9..a3a8e4aad 100644 --- a/codegen/Webhooks/HeaderSelector.php +++ b/codegen/Webhooks/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Webhooks/Model/BatchInputSubscriptionBatchUpdateRequest.php b/codegen/Webhooks/Model/BatchInputSubscriptionBatchUpdateRequest.php index c9cf9da57..111015069 100644 --- a/codegen/Webhooks/Model/BatchInputSubscriptionBatchUpdateRequest.php +++ b/codegen/Webhooks/Model/BatchInputSubscriptionBatchUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Webhooks/Model/BatchResponseSubscriptionResponse.php b/codegen/Webhooks/Model/BatchResponseSubscriptionResponse.php index 76319b27f..e20c6e0c6 100644 --- a/codegen/Webhooks/Model/BatchResponseSubscriptionResponse.php +++ b/codegen/Webhooks/Model/BatchResponseSubscriptionResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Webhooks/Model/BatchResponseSubscriptionResponseWithErrors.php b/codegen/Webhooks/Model/BatchResponseSubscriptionResponseWithErrors.php index 730ba6b1c..3dca8463e 100644 --- a/codegen/Webhooks/Model/BatchResponseSubscriptionResponseWithErrors.php +++ b/codegen/Webhooks/Model/BatchResponseSubscriptionResponseWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Webhooks/Model/Error.php b/codegen/Webhooks/Model/Error.php index d08b31442..8a50ad805 100644 --- a/codegen/Webhooks/Model/Error.php +++ b/codegen/Webhooks/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Webhooks/Model/ErrorDetail.php b/codegen/Webhooks/Model/ErrorDetail.php index 72cf456ea..23d8e6c87 100644 --- a/codegen/Webhooks/Model/ErrorDetail.php +++ b/codegen/Webhooks/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Webhooks/Model/ModelInterface.php b/codegen/Webhooks/Model/ModelInterface.php index e7d7381ab..057c081aa 100644 --- a/codegen/Webhooks/Model/ModelInterface.php +++ b/codegen/Webhooks/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Webhooks/Model/SettingsChangeRequest.php b/codegen/Webhooks/Model/SettingsChangeRequest.php index ae5c05e92..d7ac6ebba 100644 --- a/codegen/Webhooks/Model/SettingsChangeRequest.php +++ b/codegen/Webhooks/Model/SettingsChangeRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -246,10 +246,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('throttling', $data ?? [], null); $this->setIfExists('target_url', $data ?? [], null); diff --git a/codegen/Webhooks/Model/SettingsResponse.php b/codegen/Webhooks/Model/SettingsResponse.php index 8aa238086..12b1b394c 100644 --- a/codegen/Webhooks/Model/SettingsResponse.php +++ b/codegen/Webhooks/Model/SettingsResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -258,10 +258,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('throttling', $data ?? [], null); diff --git a/codegen/Webhooks/Model/StandardError.php b/codegen/Webhooks/Model/StandardError.php index a910fe3d5..134888f88 100644 --- a/codegen/Webhooks/Model/StandardError.php +++ b/codegen/Webhooks/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Webhooks/Model/SubscriptionBatchUpdateRequest.php b/codegen/Webhooks/Model/SubscriptionBatchUpdateRequest.php index e2d5df3fb..b9edac5d8 100644 --- a/codegen/Webhooks/Model/SubscriptionBatchUpdateRequest.php +++ b/codegen/Webhooks/Model/SubscriptionBatchUpdateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('active', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); diff --git a/codegen/Webhooks/Model/SubscriptionCreateRequest.php b/codegen/Webhooks/Model/SubscriptionCreateRequest.php index 17ec4600f..34b58f9c5 100644 --- a/codegen/Webhooks/Model/SubscriptionCreateRequest.php +++ b/codegen/Webhooks/Model/SubscriptionCreateRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -363,10 +363,10 @@ public function getEventTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_type_id', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Webhooks/Model/SubscriptionListResponse.php b/codegen/Webhooks/Model/SubscriptionListResponse.php index b4b6b9087..3b0e288d2 100644 --- a/codegen/Webhooks/Model/SubscriptionListResponse.php +++ b/codegen/Webhooks/Model/SubscriptionListResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('results', $data ?? [], null); } diff --git a/codegen/Webhooks/Model/SubscriptionPatchRequest.php b/codegen/Webhooks/Model/SubscriptionPatchRequest.php index cccd98be7..71e485b23 100644 --- a/codegen/Webhooks/Model/SubscriptionPatchRequest.php +++ b/codegen/Webhooks/Model/SubscriptionPatchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('active', $data ?? [], null); } diff --git a/codegen/Webhooks/Model/SubscriptionResponse.php b/codegen/Webhooks/Model/SubscriptionResponse.php index 1dd9fabdd..b55af9f84 100644 --- a/codegen/Webhooks/Model/SubscriptionResponse.php +++ b/codegen/Webhooks/Model/SubscriptionResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -381,10 +381,10 @@ public function getEventTypeAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('object_type_id', $data ?? [], null); diff --git a/codegen/Webhooks/Model/ThrottlingSettings.php b/codegen/Webhooks/Model/ThrottlingSettings.php index 053d2a16d..84a5eab5d 100644 --- a/codegen/Webhooks/Model/ThrottlingSettings.php +++ b/codegen/Webhooks/Model/ThrottlingSettings.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -240,10 +240,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('max_concurrent_requests', $data ?? [], null); } diff --git a/codegen/Webhooks/ObjectSerializer.php b/codegen/Webhooks/ObjectSerializer.php index a2cb6e502..d46e17bab 100644 --- a/codegen/Webhooks/ObjectSerializer.php +++ b/codegen/Webhooks/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/composer.json b/composer.json index 60dab831a..69da12feb 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "hubspot/api-client", - "version": "12.2.0", + "version": "13.0.0", "description": "Hubspot API client", "keywords": [ "hubspot", diff --git a/lib/Discovery/Cms/Blogs/BlogPosts/Discovery.php b/lib/Discovery/Cms/Blogs/BlogPosts/Discovery.php index 6ab1555f7..5f97ddb5b 100644 --- a/lib/Discovery/Cms/Blogs/BlogPosts/Discovery.php +++ b/lib/Discovery/Cms/Blogs/BlogPosts/Discovery.php @@ -2,10 +2,14 @@ namespace HubSpot\Discovery\Cms\Blogs\BlogPosts; -use HubSpot\Client\Cms\Blogs\BlogPosts\Api\BlogPostsApi; +use HubSpot\Client\Cms\Blogs\BlogPosts\Api\BasicApi; +use HubSpot\Client\Cms\Blogs\BlogPosts\Api\BatchApi; +use HubSpot\Client\Cms\Blogs\BlogPosts\Api\MultiLanguageApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method BlogPostsApi blogPostsApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() + * @method MultiLanguageApi multiLanguageApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Cms/Discovery.php b/lib/Discovery/Cms/Discovery.php index e1bf52ccb..8f5e6301d 100644 --- a/lib/Discovery/Cms/Discovery.php +++ b/lib/Discovery/Cms/Discovery.php @@ -10,7 +10,6 @@ * @method Domains\Discovery domains() * @method Hubdb\Discovery hubdb() * @method Pages\Discovery pages() - * @method Performance\Discovery performance() * @method SiteSearch\Discovery siteSearch() * @method SourceCode\Discovery sourceCode() * @method UrlRedirects\Discovery urlRedirects() diff --git a/lib/Discovery/Cms/Performance/Discovery.php b/lib/Discovery/Cms/Performance/Discovery.php deleted file mode 100644 index 80a77b061..000000000 --- a/lib/Discovery/Cms/Performance/Discovery.php +++ /dev/null @@ -1,13 +0,0 @@ -OwnersApi()->getPage(null, $after, 100); + $page = $this->OwnersApi()->getPage($email, $after, 100, $archived); $owners = array_merge($owners, $page->getResults()); diff --git a/lib/Discovery/Crm/Tickets/Discovery.php b/lib/Discovery/Crm/Tickets/Discovery.php index c18aa0f5c..f83fb5c4d 100644 --- a/lib/Discovery/Crm/Tickets/Discovery.php +++ b/lib/Discovery/Crm/Tickets/Discovery.php @@ -4,14 +4,12 @@ use HubSpot\Client\Crm\Tickets\Api\BasicApi; use HubSpot\Client\Crm\Tickets\Api\BatchApi; -use HubSpot\Client\Crm\Tickets\Api\MergeApi; use HubSpot\Client\Crm\Tickets\Api\SearchApi; use HubSpot\Discovery\Crm\ObjectDiscovery; /** * @method BasicApi basicApi() * @method BatchApi batchApi() - * @method MergeApi mergeApi() * @method SearchApi searchApi() */ class Discovery extends ObjectDiscovery {} diff --git a/lib/Discovery/Events/Send/Discovery.php b/lib/Discovery/Events/Send/Discovery.php index 720b33a69..bca80ea5d 100644 --- a/lib/Discovery/Events/Send/Discovery.php +++ b/lib/Discovery/Events/Send/Discovery.php @@ -2,10 +2,12 @@ namespace HubSpot\Discovery\Events\Send; -use HubSpot\Client\Events\Send\Api\CustomEventDataApi; +use HubSpot\Client\Events\Send\Api\BasicApi; +use HubSpot\Client\Events\Send\Api\BatchApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method CustomEventDataApi customEventDataApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/Discovery/Marketing/Events/Discovery.php b/lib/Discovery/Marketing/Events/Discovery.php index d8d533322..cfb237812 100644 --- a/lib/Discovery/Marketing/Events/Discovery.php +++ b/lib/Discovery/Marketing/Events/Discovery.php @@ -2,20 +2,26 @@ namespace HubSpot\Discovery\Marketing\Events; -use HubSpot\Client\Marketing\Events\Api\AttendanceSubscriberStateChangesApi; +use HubSpot\Client\Marketing\Events\Api\AddEventAttendeesApi; use HubSpot\Client\Marketing\Events\Api\BasicApi; +use HubSpot\Client\Marketing\Events\Api\BatchApi; +use HubSpot\Client\Marketing\Events\Api\ChangePropertyApi; +use HubSpot\Client\Marketing\Events\Api\IdentifiersApi; use HubSpot\Client\Marketing\Events\Api\ListAssociationsApi; -use HubSpot\Client\Marketing\Events\Api\ParticipantStateApi; +use HubSpot\Client\Marketing\Events\Api\RetrieveParticipantStateApi; use HubSpot\Client\Marketing\Events\Api\SettingsApi; use HubSpot\Client\Marketing\Events\Api\SubscriberStateChangesApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method AttendanceSubscriberStateChangesApi attendanceSubscriberStateChangesApi() - * @method BasicApi basicApi() - * @method ListAssociationsApi listAssociationsApi() - * @method ParticipantStateApi participantStateApi() - * @method SettingsApi settingsApi() - * @method SubscriberStateChangesApi subscriberStateChangesApi() + * @method AddEventAttendeesApi addEventAttendeesApi() + * @method BasicApi basicApi() + * @method BatchApi batchApi() + * @method ChangePropertyApi changePropertyApi() + * @method IdentifiersApi identifiersApi() + * @method ListAssociationsApi listAssociationsApi() + * @method RetrieveParticipantStateApi retrieveParticipantStateApi() + * @method SettingsApi settingsApi() + * @method SubscriberStateChangesApi subscriberStateChangesApi() */ class Discovery extends DiscoveryBase {} diff --git a/lib/RetryMiddlewareFactory.php b/lib/RetryMiddlewareFactory.php index f063d475e..d5c6ce34e 100644 --- a/lib/RetryMiddlewareFactory.php +++ b/lib/RetryMiddlewareFactory.php @@ -8,24 +8,34 @@ class RetryMiddlewareFactory { + public const DEFAULT_MAX_RETRIES = 5; + public const INTERNAL_ERROR_RANGES = [ + ['from' => 500, 'to' => 503], + ['from' => 520, 'to' => 599] + ]; + public static function createInternalErrorsMiddleware( ?callable $delayFunction = null, - int $maxRetries = 5 + int $maxRetries = static::DEFAULT_MAX_RETRIES ) { - return static::createMiddlewareByHttpCodeRange(500, 504, $delayFunction, $maxRetries); + return static::createMiddlewareByHttpCodeRanges( + static::INTERNAL_ERROR_RANGES, + $delayFunction, + $maxRetries + ); } public static function createRateLimitMiddleware( ?callable $delayFunction = null, - int $maxRetries = 5 + int $maxRetries = static::DEFAULT_MAX_RETRIES ) { return static::createMiddlewareByHttpCodes([429], $delayFunction, $maxRetries); } public static function createMiddlewareByHttpCodes( array $codes, - callable $delayFunction, - int $maxRetries = 5 + ?callable $delayFunction, + int $maxRetries = static::DEFAULT_MAX_RETRIES ): callable { return Middleware::retry( static::getRetryFunction($codes, $maxRetries), @@ -36,32 +46,54 @@ public static function createMiddlewareByHttpCodes( public static function createMiddlewareByHttpCodeRange( int $from, int $to, - callable $delayFunction, - int $maxRetries = 5 + ?callable $delayFunction, + int $maxRetries = static::DEFAULT_MAX_RETRIES + ): callable { + return static::createMiddlewareByHttpCodeRanges([[$from, $to]], $delayFunction, $maxRetries); + } + + /** + * Create middleware by http code ranges + * @param array $ranges [['from' => int, 'to' => int]] + */ + public static function createMiddlewareByHttpCodeRanges( + array $ranges, + ?callable $delayFunction, + int $maxRetries = static::DEFAULT_MAX_RETRIES ): callable { return Middleware::retry( - static::getRetryFunctionByRange($from, $to, $maxRetries), + static::getRetryFunctionByRanges($ranges, $maxRetries), $delayFunction ); } - public static function getRetryFunctionByRange( - int $from, - int $to, - int $maxRetries = 5 - ) { + /** + * Get retry function by code ranges + * @param array $ranges [['from' => int, 'to' => int]] + */ + public static function getRetryFunctionByRanges( + array $ranges, + int $maxRetries + ): callable { return function ( $retries, Request $request, ?Response $response = null - ) use ($from, $to, $maxRetries) { + ) use ($ranges, $maxRetries) { if ($retries >= $maxRetries) { return false; } - if ($response instanceof Response) { - if (($response->getStatusCode() >= $from) && ($response->getStatusCode() <= $to)) { - return true; + if (!$response instanceof Response) { + return false; + } + + $statusCode = $response->getStatusCode(); + foreach ($ranges as $range) { + if (key_exists('from', $range) && key_exists('to', $range)) { + if ($statusCode >= $range['from'] && $statusCode <= $range['to']) { + return true; + } } } @@ -69,8 +101,18 @@ public static function getRetryFunctionByRange( }; } - public static function getRetryFunction(array $codes, int $maxRetries = 5) - { + public static function getRetryFunctionByRange( + int $from, + int $to, + int $maxRetries = static::DEFAULT_MAX_RETRIES + ): callable { + return static::getRetryFunctionByRanges([['from' => $from, 'to' => $to]], $maxRetries); + } + + public static function getRetryFunction( + array $codes, + int $maxRetries = static::DEFAULT_MAX_RETRIES + ): callable { return function ( $retries, Request $request, diff --git a/tests/spec/Discovery/Cms/Blogs/BlogPosts/DiscoverySpec.php b/tests/spec/Discovery/Cms/Blogs/BlogPosts/DiscoverySpec.php index 82ff245ca..9dcdf7aa1 100644 --- a/tests/spec/Discovery/Cms/Blogs/BlogPosts/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/Blogs/BlogPosts/DiscoverySpec.php @@ -3,7 +3,9 @@ namespace spec\HubSpot\Discovery\Cms\Blogs\BlogPosts; use GuzzleHttp\Client; -use HubSpot\Client\Cms\Blogs\BlogPosts\Api\BlogPostsApi; +use HubSpot\Client\Cms\Blogs\BlogPosts\Api\BasicApi; +use HubSpot\Client\Cms\Blogs\BlogPosts\Api\BatchApi; +use HubSpot\Client\Cms\Blogs\BlogPosts\Api\MultiLanguageApi; use HubSpot\Config; use HubSpot\Discovery\Cms\Blogs\BlogPosts\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +24,8 @@ public function it_is_initializable() public function it_creates_clients() { - $this->blogPostsApi()->shouldHaveType(BlogPostsApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); + $this->multiLanguageApi()->shouldHaveType(MultiLanguageApi::class); } } diff --git a/tests/spec/Discovery/Cms/DiscoverySpec.php b/tests/spec/Discovery/Cms/DiscoverySpec.php index 1773208ee..12678dac4 100644 --- a/tests/spec/Discovery/Cms/DiscoverySpec.php +++ b/tests/spec/Discovery/Cms/DiscoverySpec.php @@ -26,7 +26,6 @@ public function it_creates_clients() $this->domains()->shouldHaveType(\HubSpot\Discovery\Cms\Domains\Discovery::class); $this->hubdb()->shouldHaveType(\HubSpot\Discovery\Cms\Hubdb\Discovery::class); $this->pages()->shouldHaveType(\HubSpot\Discovery\Cms\Pages\Discovery::class); - $this->performance()->shouldHaveType(\HubSpot\Discovery\Cms\Performance\Discovery::class); $this->siteSearch()->shouldHaveType(\HubSpot\Discovery\Cms\SiteSearch\Discovery::class); $this->sourceCode()->shouldHaveType(\HubSpot\Discovery\Cms\SourceCode\Discovery::class); $this->urlRedirects()->shouldHaveType(\HubSpot\Discovery\Cms\UrlRedirects\Discovery::class); diff --git a/tests/spec/Discovery/Cms/Performance/DiscoverySpec.php b/tests/spec/Discovery/Cms/Performance/DiscoverySpec.php deleted file mode 100644 index a5ea2be8a..000000000 --- a/tests/spec/Discovery/Cms/Performance/DiscoverySpec.php +++ /dev/null @@ -1,27 +0,0 @@ -beConstructedWith($client, $config); - } - - public function it_is_initializable() - { - $this->shouldHaveType(Discovery::class); - } - - public function it_creates_clients() - { - $this->publicPerformanceApi()->shouldHaveType(PublicPerformanceApi::class); - } -} diff --git a/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php b/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php index 20bded899..e76f38bb9 100644 --- a/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Associations/V4/Schema/DiscoverySpec.php @@ -3,6 +3,7 @@ namespace spec\HubSpot\Discovery\Crm\Associations\V4\Schema; use GuzzleHttp\Client; +use HubSpot\Client\Crm\Associations\V4\Schema\Api\DefinitionConfigurationsApi; use HubSpot\Client\Crm\Associations\V4\Schema\Api\DefinitionsApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Associations\V4\Schema\Discovery; @@ -23,5 +24,6 @@ public function it_is_initializable() public function it_creates_clients() { $this->definitionsApi()->shouldHaveType(DefinitionsApi::class); + $this->definitionConfigurationsApi()->shouldHaveType(DefinitionConfigurationsApi::class); } } diff --git a/tests/spec/Discovery/Crm/Companies/DiscoverySpec.php b/tests/spec/Discovery/Crm/Companies/DiscoverySpec.php index 9c892ee03..f2b67c25d 100644 --- a/tests/spec/Discovery/Crm/Companies/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Companies/DiscoverySpec.php @@ -5,7 +5,6 @@ use GuzzleHttp\Client; use HubSpot\Client\Crm\Companies\Api\BasicApi; use HubSpot\Client\Crm\Companies\Api\BatchApi; -use HubSpot\Client\Crm\Companies\Api\MergeApi; use HubSpot\Client\Crm\Companies\Api\SearchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Companies\Discovery; @@ -27,7 +26,6 @@ public function it_creates_clients() { $this->basicApi()->shouldHaveType(BasicApi::class); $this->batchApi()->shouldHaveType(BatchApi::class); - $this->mergeApi()->shouldHaveType(MergeApi::class); $this->searchApi()->shouldHaveType(SearchApi::class); } } diff --git a/tests/spec/Discovery/Crm/Contacts/DiscoverySpec.php b/tests/spec/Discovery/Crm/Contacts/DiscoverySpec.php index 362bf585e..5c98c753e 100644 --- a/tests/spec/Discovery/Crm/Contacts/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Contacts/DiscoverySpec.php @@ -5,8 +5,6 @@ use GuzzleHttp\Client; use HubSpot\Client\Crm\Contacts\Api\BasicApi; use HubSpot\Client\Crm\Contacts\Api\BatchApi; -use HubSpot\Client\Crm\Contacts\Api\GDPRApi; -use HubSpot\Client\Crm\Contacts\Api\MergeApi; use HubSpot\Client\Crm\Contacts\Api\SearchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Contacts\Discovery; @@ -28,8 +26,6 @@ public function it_creates_clients() { $this->basicApi()->shouldHaveType(BasicApi::class); $this->batchApi()->shouldHaveType(BatchApi::class); - $this->gdprApi()->shouldHaveType(GDPRApi::class); - $this->mergeApi()->shouldHaveType(MergeApi::class); $this->searchApi()->shouldHaveType(SearchApi::class); } } diff --git a/tests/spec/Discovery/Crm/Deals/DiscoverySpec.php b/tests/spec/Discovery/Crm/Deals/DiscoverySpec.php index 71dd306aa..ace3ab6f5 100644 --- a/tests/spec/Discovery/Crm/Deals/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Deals/DiscoverySpec.php @@ -5,7 +5,6 @@ use GuzzleHttp\Client; use HubSpot\Client\Crm\Deals\Api\BasicApi; use HubSpot\Client\Crm\Deals\Api\BatchApi; -use HubSpot\Client\Crm\Deals\Api\MergeApi; use HubSpot\Client\Crm\Deals\Api\SearchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Deals\Discovery; @@ -27,7 +26,6 @@ public function it_creates_clients() { $this->basicApi()->shouldHaveType(BasicApi::class); $this->batchApi()->shouldHaveType(BatchApi::class); - $this->mergeApi()->shouldHaveType(MergeApi::class); $this->searchApi()->shouldHaveType(SearchApi::class); } } diff --git a/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php b/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php index 1c6133cbe..0a2f37fe3 100644 --- a/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Extensions/Calling/DiscoverySpec.php @@ -3,6 +3,7 @@ namespace spec\HubSpot\Discovery\Crm\Extensions\Calling; use GuzzleHttp\Client; +use HubSpot\Client\Crm\Extensions\Calling\Api\ChannelConnectionSettingsApi; use HubSpot\Client\Crm\Extensions\Calling\Api\RecordingSettingsApi; use HubSpot\Client\Crm\Extensions\Calling\Api\SettingsApi; use HubSpot\Config; @@ -23,6 +24,7 @@ public function it_is_initializable() public function it_creates_clients() { + $this->channelConnectionSettingsApi()->shouldHaveType(ChannelConnectionSettingsApi::class); $this->recordingSettingsApi()->shouldHaveType(RecordingSettingsApi::class); $this->settingsApi()->shouldHaveType(SettingsApi::class); } diff --git a/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php b/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php index 6331a552d..a508b6b2a 100644 --- a/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php @@ -5,7 +5,6 @@ use GuzzleHttp\Client; use HubSpot\Client\Crm\Tickets\Api\BasicApi; use HubSpot\Client\Crm\Tickets\Api\BatchApi; -use HubSpot\Client\Crm\Tickets\Api\MergeApi; use HubSpot\Client\Crm\Tickets\Api\SearchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Tickets\Discovery; @@ -27,7 +26,6 @@ public function it_creates_clients() { $this->basicApi()->shouldHaveType(BasicApi::class); $this->batchApi()->shouldHaveType(BatchApi::class); - $this->mergeApi()->shouldHaveType(MergeApi::class); $this->searchApi()->shouldHaveType(SearchApi::class); } } diff --git a/tests/spec/Discovery/Events/Send/DiscoverySpec.php b/tests/spec/Discovery/Events/Send/DiscoverySpec.php index fa31d074c..2d627f489 100644 --- a/tests/spec/Discovery/Events/Send/DiscoverySpec.php +++ b/tests/spec/Discovery/Events/Send/DiscoverySpec.php @@ -3,7 +3,8 @@ namespace spec\HubSpot\Discovery\Events\Send; use GuzzleHttp\Client; -use HubSpot\Client\Events\Send\Api\CustomEventDataApi; +use HubSpot\Client\Events\Send\Api\BasicApi; +use HubSpot\Client\Events\Send\Api\BatchApi; use HubSpot\Config; use HubSpot\Discovery\Events\Send\Discovery; use PhpSpec\ObjectBehavior; @@ -22,6 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->customEventDataApi()->shouldHaveType(CustomEventDataApi::class); + $this->basicApi()->shouldHaveType(BasicApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); } } diff --git a/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php b/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php index 2bc371f20..100602928 100644 --- a/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php +++ b/tests/spec/Discovery/Marketing/Events/DiscoverySpec.php @@ -3,10 +3,13 @@ namespace spec\HubSpot\Discovery\Marketing\Events; use GuzzleHttp\Client; -use HubSpot\Client\Marketing\Events\Api\AttendanceSubscriberStateChangesApi; +use HubSpot\Client\Marketing\Events\Api\AddEventAttendeesApi; use HubSpot\Client\Marketing\Events\Api\BasicApi; +use HubSpot\Client\Marketing\Events\Api\BatchApi; +use HubSpot\Client\Marketing\Events\Api\ChangePropertyApi; +use HubSpot\Client\Marketing\Events\Api\IdentifiersApi; use HubSpot\Client\Marketing\Events\Api\ListAssociationsApi; -use HubSpot\Client\Marketing\Events\Api\ParticipantStateApi; +use HubSpot\Client\Marketing\Events\Api\RetrieveParticipantStateApi; use HubSpot\Client\Marketing\Events\Api\SettingsApi; use HubSpot\Client\Marketing\Events\Api\SubscriberStateChangesApi; use HubSpot\Config; @@ -27,10 +30,13 @@ public function it_is_initializable() public function it_creates_clients() { - $this->attendanceSubscriberStateChangesApi()->shouldHaveType(AttendanceSubscriberStateChangesApi::class); + $this->addEventAttendeesApi()->shouldHaveType(AddEventAttendeesApi::class); $this->basicApi()->shouldHaveType(BasicApi::class); + $this->batchApi()->shouldHaveType(BatchApi::class); + $this->changePropertyApi()->shouldHaveType(ChangePropertyApi::class); + $this->identifiersApi()->shouldHaveType(IdentifiersApi::class); $this->listAssociationsApi()->shouldHaveType(ListAssociationsApi::class); - $this->participantStateApi()->shouldHaveType(ParticipantStateApi::class); + $this->retrieveParticipantStateApi()->shouldHaveType(RetrieveParticipantStateApi::class); $this->settingsApi()->shouldHaveType(SettingsApi::class); $this->subscriberStateChangesApi()->shouldHaveType(SubscriberStateChangesApi::class); }